From d92f5e23ddfd4a6b5bbeb9ff332e648d5d534658 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 23 Feb 2012 18:49:20 +0100 Subject: Use link targets as keys in the blacklist hash table Fixes lp:939258 --- src/messages-service.c | 54 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/src/messages-service.c b/src/messages-service.c index a21435c..a5ddaf4 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -321,26 +321,56 @@ desktop_file_from_keyfile (const gchar * definition_file) return desktopfile; } +static gchar * +get_symlink_target (const gchar *path, + GError **error) +{ + GFile *file; + GFileInfo *fileinfo; + gchar *target = NULL; + + file = g_file_new_for_path (path); + + fileinfo = g_file_query_info (file, "standard::*", + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + NULL, error); + g_object_unref (file); + + if (!fileinfo) + return NULL; + + if (!g_file_info_get_is_symlink (fileinfo) || + !(target = g_strdup (g_file_info_get_symlink_target (fileinfo)))) + { + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_NOT_SYMBOLIC_LINK, + "'%s' is not a symbolic link", + path); + } + + g_object_unref (fileinfo); + return target; +} + /* Add a definition file into the black list and eclipse any launchers that have the same file. */ static gboolean blacklist_add (gpointer udata) { gchar * definition_file = (gchar *)udata; - /* Dump the file */ - gchar * desktop; - g_file_get_contents(definition_file, &desktop, NULL, NULL); - if (desktop == NULL) { - g_warning("Couldn't get data out of: %s", definition_file); - return FALSE; - } + gchar * target; + GError *error = NULL; - /* Clean up the data */ - gchar * trimdesktop = pango_trim_string(desktop); - g_free(desktop); + target = get_symlink_target (definition_file, &error); + if (!target) { + g_warning ("Error loading blacklist file: %s", error->message); + g_error_free (error); + return FALSE; + } - blacklist_add_core(trimdesktop, definition_file); - g_free(trimdesktop); + blacklist_add_core(target, definition_file); + g_free(target); return FALSE; } -- cgit v1.2.3 From 435bd3b5e91e4e556624ac8b402b551e72ed376d Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Thu, 8 Mar 2012 15:50:50 -0600 Subject: Moved coverage tooling to own Makefile; gcovr now optional. --- Makefile.am | 35 +---------------------------------- m4/gcov.m4 | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 44 deletions(-) diff --git a/Makefile.am b/Makefile.am index e31937a..6d4e4ee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,37 +33,4 @@ dist-hook: 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/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 a2fc906f1618df091d92dcf060b2622f7881d249 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 13 Mar 2012 20:32:26 -0500 Subject: Made gcovr optional. --- Makefile.am | 36 +----------------------------------- Makefile.am.coverage | 41 +++++++++++++++++++++++++++++++++++++++++ configure.ac | 3 +++ m4/gcov.m4 | 23 +++++++++++++---------- 4 files changed, 58 insertions(+), 45 deletions(-) create mode 100644 Makefile.am.coverage diff --git a/Makefile.am b/Makefile.am index e31937a..45c511a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,38 +32,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..b0a2f8c --- /dev/null +++ b/Makefile.am.coverage @@ -0,0 +1,41 @@ + +# Coverage targets + +if HAVE_GCOV + + .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 + +if HAVE_GCOVR + + .PHONY: coverage-gcovr generate-coverage-gcovr clean-coverage-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 28f9091..159c740 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,9 @@ AC_SUBST(STATUS_PROVIDER_EMESENE_LIBS) 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 f39ce884e73f9504c1ef3c81ed8241789f705f71 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Wed, 14 Mar 2012 18:57:13 +0100 Subject: Use basename of the desktop file as key in the blacklist hash table This is superior to using symlinks, as this also allows copying the desktop files into the blacklist directory. Copying is the default when dragging and dropping an application into that folder. --- src/messages-service.c | 71 ++++++++++++++------------------------------------ 1 file changed, 20 insertions(+), 51 deletions(-) diff --git a/src/messages-service.c b/src/messages-service.c index a5ddaf4..1d9c162 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -321,56 +321,14 @@ desktop_file_from_keyfile (const gchar * definition_file) return desktopfile; } -static gchar * -get_symlink_target (const gchar *path, - GError **error) -{ - GFile *file; - GFileInfo *fileinfo; - gchar *target = NULL; - - file = g_file_new_for_path (path); - - fileinfo = g_file_query_info (file, "standard::*", - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, - NULL, error); - g_object_unref (file); - - if (!fileinfo) - return NULL; - - if (!g_file_info_get_is_symlink (fileinfo) || - !(target = g_strdup (g_file_info_get_symlink_target (fileinfo)))) - { - g_set_error (error, - G_IO_ERROR, - G_IO_ERROR_NOT_SYMBOLIC_LINK, - "'%s' is not a symbolic link", - path); - } - - g_object_unref (fileinfo); - return target; -} - /* Add a definition file into the black list and eclipse any launchers that have the same file. */ static gboolean blacklist_add (gpointer udata) { gchar * definition_file = (gchar *)udata; - gchar * target; - GError *error = NULL; - - target = get_symlink_target (definition_file, &error); - if (!target) { - g_warning ("Error loading blacklist file: %s", error->message); - g_error_free (error); - return FALSE; - } - blacklist_add_core(target, definition_file); - g_free(target); + blacklist_add_core(definition_file, definition_file); return FALSE; } @@ -382,8 +340,10 @@ blacklist_add (gpointer udata) static void blacklist_add_core (gchar * desktop, gchar * definition) { + gchar *basename = g_path_get_basename(desktop); + /* Check for conflicts */ - gpointer data = g_hash_table_lookup(blacklist, desktop); + gpointer data = g_hash_table_lookup(blacklist, basename); if (data != NULL) { gchar * oldfile = (gchar *)data; if (!g_strcmp0(oldfile, definition)) { @@ -392,27 +352,31 @@ blacklist_add_core (gchar * desktop, gchar * definition) g_warning("Already have desktop file '%s' in blacklist file '%s' not adding from '%s'", desktop, oldfile, definition); } + g_free(basename); return; } /* Actually blacklist this thing */ - g_hash_table_insert(blacklist, g_strdup(desktop), g_strdup(definition)); + g_hash_table_insert(blacklist, g_strdup(basename), g_strdup(definition)); g_debug("Adding Blacklist item '%s' for desktop '%s'", definition, desktop); /* Go through and eclipse folks */ GList * launcher; for (launcher = launcherList; launcher != NULL; launcher = launcher->next) { launcherList_t * item = (launcherList_t *)launcher->data; - if (!g_strcmp0(desktop, launcher_menu_item_get_desktop(item->menuitem))) { + gchar * item_basename = g_path_get_basename(launcher_menu_item_get_desktop(item->menuitem)); + if (!g_strcmp0(basename, item_basename)) { launcher_menu_item_set_eclipsed(item->menuitem, TRUE); dbusmenu_menuitem_property_set_bool(item->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); } + g_free(item_basename); } check_hidden(); /* Shouldn't need a resort here as hiding shouldn't cause things to move other than this item disappearing. */ + g_free(basename); return; } @@ -474,15 +438,20 @@ blacklist_remove (gpointer data) static gboolean blacklist_check (const gchar * desktop_file) { - g_debug("Checking blacklist for: %s", desktop_file); - if (blacklist == NULL) return FALSE; + gchar *basename = g_path_get_basename(desktop_file); + gboolean found; + + g_debug("Checking blacklist for: %s", basename); - if (g_hash_table_lookup(blacklist, desktop_file)) { + if (blacklist && g_hash_table_lookup(blacklist, basename)) { g_debug("\tFound!"); - return TRUE; + found = TRUE; } + else + found = FALSE; - return FALSE; + g_free(basename); + return found; } /* A callback everytime the blacklist directory changes -- cgit v1.2.3 From b11161a7ffab99f5415e4136ce9ddd0bf6e1fa76 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Thu, 15 Mar 2012 11:30:13 -0500 Subject: Dummy commit on 'no rule' err. --- Makefile.am | 4 ++++ configure.ac | 20 +++++++++++++++++ m4/gtest.m4 | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/Makefile.am | 24 ++++++++++++++++++++ test/test-gtest.cpp | 13 +++++++++++ 5 files changed, 124 insertions(+) create mode 100644 m4/gtest.m4 create mode 100644 test/Makefile.am create mode 100644 test/test-gtest.cpp diff --git a/Makefile.am b/Makefile.am index 45c511a..1e8aa57 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,10 @@ SUBDIRS = \ data \ po +if BUILD_TESTS +SUBDIRS += test +endif + DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall --enable-deprecations dist-hook: diff --git a/configure.ac b/configure.ac index 159c740..a85773d 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,9 @@ AS_IF([test "x$enable_deprecations" = xno], [CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE -DGTK_DISABLE_SINGLE_INCLUDES"] ) +# the Google Test targets are cpp +AC_PROG_CXX + ########################### # Dependencies ########################### @@ -68,6 +71,15 @@ AS_IF([test "x$with_gtk" = x3], AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) +########################### +# Test Dependencies +########################### + +AC_ARG_ENABLE([tests], + AC_HELP_STRING([--disable-tests], [Disable test scripts and tools]),, + [enable_tests=auto]) +AM_CONDITIONAL(BUILD_TESTS, test xyes = xyes) + ########################### # Status Provider Deps ########################### @@ -103,6 +115,13 @@ AC_SUBST(COVERAGE_CFLAGS) AC_SUBST(COVERAGE_CXXFLAGS) AC_SUBST(COVERAGE_LDFLAGS) +########################### +# Google Test framework +########################### + +m4_include([m4/gtest.m4]) +CHECK_GTEST + ########################### # Check to see if we're local ########################### @@ -192,6 +211,7 @@ data/icons/scalable/Makefile data/icons/scalable/status/Makefile data/icons/scalable/categories/Makefile po/Makefile.in +test/Makefile ]) ########################### diff --git a/m4/gtest.m4 b/m4/gtest.m4 new file mode 100644 index 0000000..2de334c --- /dev/null +++ b/m4/gtest.m4 @@ -0,0 +1,63 @@ +# Copyright (C) 2012 Canonical, Ltd. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# Checks whether the gtest source is available on the system. Allows for +# adjusting the include and source path. Sets have_gtest=yes if the source is +# present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and +# source location respectively. +AC_DEFUN([CHECK_GTEST], +[ + AC_ARG_WITH([gtest-include-path], + [AS_HELP_STRING([--with-gtest-include-path], + [location of the Google test headers])], + [GTEST_CPPFLAGS="-I$withval"]) + + AC_ARG_WITH([gtest-source-path], + [AS_HELP_STRING([--with-gtest-source-path], + [location of the Google test sources, defaults to /usr/src/gtest])], + [GTEST_SOURCE="$withval"], + [GTEST_SOURCE="/usr/src/gtest"]) + + GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE" + + AC_LANG_PUSH([C++]) + + tmp_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GTEST_CPPFLAGS" + + AC_CHECK_HEADER([gtest/gtest.h]) + + CPPFLAGS="$tmp_CPPFLAGS" + + AC_LANG_POP + + AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc] + [$GTEST_SOURCE/src/gtest_main.cc], + [have_gtest_source=yes], + [have_gtest_source=no]) + + AS_IF([test "x$ac_cv_header_gtest_gtest_h" = xyes -a \ + "x$have_gtest_source" = xyes], + [have_gtest=yes] + [AC_SUBST(GTEST_CPPFLAGS)] + [AC_SUBST(GTEST_SOURCE)], + [have_gtest=no]) +]) # CHECK_GTEST diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..fa7bace --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,24 @@ + +check_LIBRARIES = libgtest.a + +AM_CPPFLAGS = $(GTEST_CPPFLAGS) + +nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc +libgtest_a_CPPFLAGS = $(GTEST_CPPFLAGS) -w +libgtest_a_CXXFLAGS = $(AM_CXXFLAGS) + +libgtest_a_SOURCES = \ + $(GTEST_SOURCE)/src/gtest-all.cc \ + $(GTEST_SOURCE)/src/gtest-main.cc +lib_gtest_a_CPPFLAGS = \ + $(GTEST_CPPFLAGS) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir) +libxorg_gtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS) + +check_PROGRAMS = test_gtest + +test_gtest_SOURCES = test-gtest.cpp + +test_gtest_LDADD = \ + libgtest.a diff --git a/test/test-gtest.cpp b/test/test-gtest.cpp new file mode 100644 index 0000000..739a5c8 --- /dev/null +++ b/test/test-gtest.cpp @@ -0,0 +1,13 @@ + +#include +#include + + + + +int +main (int argc, char ** argv) +{ + printf("oheck\n"); + return 0; +} -- cgit v1.2.3 From bacad6ee225001ec39b6263ceb4aa99d55a67ba6 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Thu, 15 Mar 2012 18:22:37 -0500 Subject: Temp commit for review by charles. --- configure.ac | 8 ++++++-- test/Makefile.am | 28 ++++++++++++++++------------ test/test-gtest.cpp | 21 ++++++++++++--------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index a85773d..8646a0f 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,7 @@ PANEL_REQUIRED_VERSION=2.0.0 INDICATE_REQUIRED_VERSION=0.6.90 INDICATOR_REQUIRED_VERSION=0.3.19 DBUSMENUGTK_REQUIRED_VERSION=0.5.90 +GLIB_REQUIRED_VERSION=2.31.20 AC_ARG_WITH([gtk], [AS_HELP_STRING([--with-gtk], @@ -57,14 +58,17 @@ AS_IF([test "x$with_gtk" = x3], gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION indicate-0.7 >= $INDICATE_REQUIRED_VERSION - dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) + dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION + glib-2.0 >= GLIB_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.7 >= $INDICATE_REQUIRED_VERSION - dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) + dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION + glib-2.0 >= GLIB_REQUIRED_VERSION) ], [AC_MSG_FAILURE([Value for --with-indicator-gtk was neither 2 nor 3])] ) diff --git a/test/Makefile.am b/test/Makefile.am index fa7bace..7b59f54 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,24 +1,28 @@ check_LIBRARIES = libgtest.a +check_PROGRAMS = test-gtest + +TESTS = AM_CPPFLAGS = $(GTEST_CPPFLAGS) nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc -libgtest_a_CPPFLAGS = $(GTEST_CPPFLAGS) -w -libgtest_a_CXXFLAGS = $(AM_CXXFLAGS) - libgtest_a_SOURCES = \ $(GTEST_SOURCE)/src/gtest-all.cc \ - $(GTEST_SOURCE)/src/gtest-main.cc -lib_gtest_a_CPPFLAGS = \ - $(GTEST_CPPFLAGS) \ - -I$(top_srcdir)/include \ - -I$(top_srcdir) -libxorg_gtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS) - -check_PROGRAMS = test_gtest + $(GTEST_SOURCE)/src/gtest_main.cc +libgtest_a_CPPFLAGS = \ + $(GTEST_CPPFLAGS) -w +libgtest_a_CXXFLAGS = \ + $(AM_CXXFLAGS) -test_gtest_SOURCES = test-gtest.cpp +TESTS += test-gtest +test_gtest_SOURCES = \ + test-gtest.cpp +test_gtest_CPPFLAGS = \ + $(APPLET_CFLAGS) \ + -I$(top_srcdir)/src +test_gtest_LDFLAGS = -pthread test_gtest_LDADD = \ + $(APPLET_LIBS) \ libgtest.a diff --git a/test/test-gtest.cpp b/test/test-gtest.cpp index 739a5c8..87edeab 100644 --- a/test/test-gtest.cpp +++ b/test/test-gtest.cpp @@ -1,13 +1,16 @@ -#include -#include - - +#include +#include +extern "C" { + #include "launcher-menu-item.h" +} -int -main (int argc, char ** argv) -{ - printf("oheck\n"); - return 0; +TEST(LauncherMenuItem, EmptyAtStart) { + gboolean result; + // FIXME + //LauncherMenuItem * test_li = ???; + gboolean test_eclipsed; + //result = launcher_menu_item_set_eclipsed(test_li, test_eclipsed); + EXPECT_TRUE(false); } -- cgit v1.2.3 From a5695b6ae268abc5c446a734ea8dbbcc30bc47fb Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Fri, 16 Mar 2012 16:11:07 -0500 Subject: Experimental Makefile.am changes to support GTest. --- test/Makefile.am | 6 ++++-- test/test-gtest.cpp | 14 +++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index 7b59f54..e262bae 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -18,10 +18,12 @@ libgtest_a_CXXFLAGS = \ TESTS += test-gtest test_gtest_SOURCES = \ + $(top_srcdir)/src/launcher-menu-item.c \ + $(top_srcdir)/src/default-applications.c \ + $(top_srcdir)/src/seen-db.c \ test-gtest.cpp test_gtest_CPPFLAGS = \ - $(APPLET_CFLAGS) \ - -I$(top_srcdir)/src + $(APPLET_CFLAGS) test_gtest_LDFLAGS = -pthread test_gtest_LDADD = \ $(APPLET_LIBS) \ diff --git a/test/test-gtest.cpp b/test/test-gtest.cpp index 87edeab..bb9943d 100644 --- a/test/test-gtest.cpp +++ b/test/test-gtest.cpp @@ -6,11 +6,11 @@ extern "C" { #include "launcher-menu-item.h" } -TEST(LauncherMenuItem, EmptyAtStart) { - gboolean result; - // FIXME - //LauncherMenuItem * test_li = ???; - gboolean test_eclipsed; - //result = launcher_menu_item_set_eclipsed(test_li, test_eclipsed); - EXPECT_TRUE(false); +TEST(LauncherMenuItem, NameInitialized) { + g_type_init(); + //const gchar * expected = "foo"; + //LauncherMenuItem * test_li = launcher_menu_item_new ("foo"); + //gchar * result = launcher_menu_item_get_name(test_li); + //EXPECT_EQ(0, strcmp("foo", result)); + EXPECT_TRUE(true); } -- cgit v1.2.3 From 904328716e06d6282460979026e336b36d3968b7 Mon Sep 17 00:00:00 2001 From: Gabor Kelemen Date: Sat, 17 Mar 2012 00:14:37 +0100 Subject: Change i18n header to gi18n-lib.h to translate the accessible description. LP: #957525 --- 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 2c5e3cd..748b73b 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -26,7 +26,7 @@ with this program. If not, see . #include #include #include -#include +#include #include #include -- cgit v1.2.3 From 25fcbef28e8b33fc1ee624359ac4b39fbcb741dc Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Mon, 19 Mar 2012 10:14:53 -0500 Subject: Charles-advised changes to test/Makefile.am for proper CPPFLAGS. --- test/Makefile.am | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index e262bae..e359ad4 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,7 +4,8 @@ check_PROGRAMS = test-gtest TESTS = -AM_CPPFLAGS = $(GTEST_CPPFLAGS) +AM_CPPFLAGS = $(GTEST_CPPFLAGS) \ + -I${top_srcdir}/src nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc libgtest_a_SOURCES = \ @@ -14,6 +15,8 @@ libgtest_a_CPPFLAGS = \ $(GTEST_CPPFLAGS) -w libgtest_a_CXXFLAGS = \ $(AM_CXXFLAGS) +libgtest_a_CPPFLAGS = \ + $(AM_CPPFLAGS) TESTS += test-gtest @@ -23,7 +26,8 @@ test_gtest_SOURCES = \ $(top_srcdir)/src/seen-db.c \ test-gtest.cpp test_gtest_CPPFLAGS = \ - $(APPLET_CFLAGS) + $(APPLET_CFLAGS) \ + $(AM_CPPFLAGS) test_gtest_LDFLAGS = -pthread test_gtest_LDADD = \ $(APPLET_LIBS) \ -- cgit v1.2.3 From 46ff11853c8c1ea7ca02ad8786e9bb222fa7a7cf Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Mon, 19 Mar 2012 12:35:49 -0500 Subject: Made gcovr optional. --- Makefile.am | 35 +---------------------------------- Makefile.am.coverage | 44 ++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 3 +++ m4/gcov.m4 | 23 +++++++++++++---------- 4 files changed, 61 insertions(+), 44 deletions(-) create mode 100644 Makefile.am.coverage diff --git a/Makefile.am b/Makefile.am index e31937a..6d4e4ee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,37 +33,4 @@ dist-hook: 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..9edc849 --- /dev/null +++ b/Makefile.am.coverage @@ -0,0 +1,44 @@ + +# Coverage targets + +if HAVE_GCOV + +.PHONY: clean-gcda +clean-gcda: + @echo Removing old coverage results + -find -name '*.gcda' -print | xargs -r rm + +.PHONY: coverage-html generate-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 + +if HAVE_GCOVR + +.PHONY: coverage-gcovr generate-coverage-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 + +.PHONY: clean-coverage-html clean-coverage-gcovr +clean-local: clean-coverage-html clean-coverage-gcovr diff --git a/configure.ac b/configure.ac index 179d679..8ba218e 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,9 @@ AC_SUBST(STATUS_PROVIDER_EMESENE_LIBS) 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 b85b7c4ad314a27e6f4b08830305ccfaf6cc3d1e Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Mon, 19 Mar 2012 12:46:11 -0500 Subject: Tested moving PHONY clean targets to top of Makefile. --- Makefile.am.coverage | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am.coverage b/Makefile.am.coverage index 9edc849..296ad10 100644 --- a/Makefile.am.coverage +++ b/Makefile.am.coverage @@ -1,6 +1,9 @@ # Coverage targets +.PHONY: clean-coverage-html clean-coverage-gcovr +clean-local: clean-coverage-html clean-coverage-gcovr + if HAVE_GCOV .PHONY: clean-gcda @@ -39,6 +42,3 @@ clean-coverage-gcovr: clean-gcda endif # HAVE_GCOVR endif # HAVE_GCOV - -.PHONY: clean-coverage-html clean-coverage-gcovr -clean-local: clean-coverage-html clean-coverage-gcovr -- cgit v1.2.3 From b5b2b08a71f9babbadeb19ac956ba0029a7ff080 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Mon, 19 Mar 2012 13:02:04 -0500 Subject: Consolidated PHONYs. --- Makefile.am.coverage | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.am.coverage b/Makefile.am.coverage index 296ad10..9c59b95 100644 --- a/Makefile.am.coverage +++ b/Makefile.am.coverage @@ -1,17 +1,18 @@ # Coverage targets -.PHONY: clean-coverage-html clean-coverage-gcovr +.PHONY: clean-gcda \ + coverage-html generate-coverage-html clean-coverage-html \ + coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr + clean-local: clean-coverage-html clean-coverage-gcovr if HAVE_GCOV -.PHONY: clean-gcda clean-gcda: @echo Removing old coverage results -find -name '*.gcda' -print | xargs -r rm -.PHONY: coverage-html generate-coverage-html coverage-html: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html @@ -27,7 +28,6 @@ clean-coverage-html: clean-gcda if HAVE_GCOVR -.PHONY: coverage-gcovr generate-coverage-gcovr coverage-gcovr: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr -- cgit v1.2.3 From ab5696a78727fc9d20a5679481876e926baf7de7 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Mon, 19 Mar 2012 13:38:41 -0500 Subject: Corrected a Makefile merge omission for tests, stripped down dummy test. --- Makefile.am | 5 +++++ test/test-gtest.cpp | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 6d4e4ee..0b5a4a3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,11 @@ SUBDIRS = \ data \ po +if BUILD_TESTS +SUBDIRS += \ + test +endif + DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall --enable-deprecations dist-hook: diff --git a/test/test-gtest.cpp b/test/test-gtest.cpp index bb9943d..1cc97be 100644 --- a/test/test-gtest.cpp +++ b/test/test-gtest.cpp @@ -8,9 +8,5 @@ extern "C" { TEST(LauncherMenuItem, NameInitialized) { g_type_init(); - //const gchar * expected = "foo"; - //LauncherMenuItem * test_li = launcher_menu_item_new ("foo"); - //gchar * result = launcher_menu_item_get_name(test_li); - //EXPECT_EQ(0, strcmp("foo", result)); EXPECT_TRUE(true); } -- cgit v1.2.3 From 6251928d97a1e10fb7e0e4c2df6372e8cead133e Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 20 Mar 2012 14:28:35 -0500 Subject: Attempt to build lib of code under test. --- test/Makefile.am | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/test/Makefile.am b/test/Makefile.am index e359ad4..522568a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -32,3 +32,56 @@ test_gtest_LDFLAGS = -pthread test_gtest_LDADD = \ $(APPLET_LIBS) \ libgtest.a + + +###################################### +# Lib containing code under test +###################################### + +lib_LTLIBRARIES = \ + libindicator-messages-service.la + +libindicator_messages_service_la_HEADERS = \ + $(top_srcdir)/src/default-applications.h \ + $(top_srcdir)/src/messages-service-dbus.h \ + $(top_srcdir)/src/gen-messages-service.xml.h \ + $(top_srcdir)/src/im-menu-item.h \ + $(top_srcdir)/src/app-menu-item.h \ + $(top_srcdir)/src/launcher-menu-item.h \ + $(top_srcdir)/src/seen-db.h \ + $(top_srcdir)/src/dirs.h \ + $(top_srcdir)/src/dbus-data.h \ + $(top_srcdir)/src/status-items.h + +libindicator_messages_service_la_SOURCES = \ + $(top_srcdir)/src/default-applications.c \ + $(top_srcdir)/src/messages-service.c \ + $(top_srcdir)/src/messages-service-dbus.c \ + $(top_srcdir)/src/gen-messages-service.xml.c \ + $(top_srcdir)/src/im-menu-item.c \ + $(top_srcdir)/src/app-menu-item.c \ + $(top_srcdir)/src/launcher-menu-item.c \ + $(top_srcdir)/src/seen-db.c \ + $(top_srcdir)/src/status-items.c + +libindicator_messages_service_ladir = \ + $(includedir)/libindicator-messages-service/ + +libindicator_messages_service_la_CFLAGS = \ + $(APPLET_CFLAGS) \ + $(COVERAGE_CFLAGS) \ + -Wall \ + -Wl,-Bsymbolic-functions \ + -Wl,-z,defs \ + -Wl,--as-needed \ + -Werror \ + -DG_LOG_DOMAIN=\"Indicator-Messages\" \ + -DSTATUS_PROVIDER_DIR=\"$(STATUS_PROVIDER_DIR)\" + +libindicator_messages_service_la_LIBADD = \ + $(APPLET_LIBS) \ + libindicator-messages-status-provider.la + +libindicator_messages_service_la_LDFLAGS = \ + $(COVERAGE_LDFLAGS) + -- cgit v1.2.3 From e5fe465d054d557eb0e06233e0551ce9cdacc7ba Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Tue, 20 Mar 2012 15:42:45 -0400 Subject: base64_decode the icon and use dbusmenu_menuitem_property_set_byte_array to set it (LP: #960553) --- src/im-menu-item.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/im-menu-item.c b/src/im-menu-item.c index f07fff9..7466d3e 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -175,7 +175,11 @@ im_menu_item_finalize (GObject *object) static void icon_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const gchar * propertydata, gpointer data) { - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(data), INDICATOR_MENUITEM_PROP_ICON, propertydata); + gsize len; + guchar *icon; + icon = g_base64_decode (propertydata, &len); + dbusmenu_menuitem_property_set_byte_array(DBUSMENU_MENUITEM(data), INDICATOR_MENUITEM_PROP_ICON, icon, len); + g_free (icon); return; } -- cgit v1.2.3 From f7d971a8407224ddd8b1b8744d18a33032c9142d Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 20 Mar 2012 15:30:16 -0500 Subject: Makefile fixes for code under test lib. --- Makefile.am | 7 +++++++ configure.ac | 3 +-- test/Makefile.am | 3 +-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0b5a4a3..bef67bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,8 +7,15 @@ SUBDIRS = \ if BUILD_TESTS SUBDIRS += \ test + +# build src first +test: src + endif + + + DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall --enable-deprecations dist-hook: diff --git a/configure.ac b/configure.ac index 8646a0f..5ec945a 100644 --- a/configure.ac +++ b/configure.ac @@ -59,8 +59,7 @@ AS_IF([test "x$with_gtk" = x3], indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION indicate-0.7 >= $INDICATE_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION - glib-2.0 >= GLIB_REQUIRED_VERSION) - + glib-2.0 >= $GLIB_REQUIRED_VERSION) ], [test "x$with_gtk" = x2], [PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION diff --git a/test/Makefile.am b/test/Makefile.am index 522568a..8986a40 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -80,8 +80,7 @@ libindicator_messages_service_la_CFLAGS = \ libindicator_messages_service_la_LIBADD = \ $(APPLET_LIBS) \ - libindicator-messages-status-provider.la + $(top_builddir)/src/.libs/libindicator-messages-status-provider.la libindicator_messages_service_la_LDFLAGS = \ $(COVERAGE_LDFLAGS) - -- cgit v1.2.3 From 4700a77b61efa6bb089d019223177e47cdc5c3db Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 20 Mar 2012 16:36:08 -0500 Subject: Charles-suggested fixes for gmodule dependency. --- configure.ac | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5ec945a..1690ad6 100644 --- a/configure.ac +++ b/configure.ac @@ -59,7 +59,8 @@ AS_IF([test "x$with_gtk" = x3], indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION indicate-0.7 >= $INDICATE_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION - glib-2.0 >= $GLIB_REQUIRED_VERSION) + glib-2.0 >= $GLIB_REQUIRED_VERSION + gmodule-2.0 >= $GLIB_REQUIRED_VERSION) ], [test "x$with_gtk" = x2], [PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION @@ -67,7 +68,8 @@ AS_IF([test "x$with_gtk" = x3], indicator-0.4 >= $INDICATOR_REQUIRED_VERSION indicate-0.7 >= $INDICATE_REQUIRED_VERSION dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION - glib-2.0 >= GLIB_REQUIRED_VERSION) + glib-2.0 >= $GLIB_REQUIRED_VERSION + gmodule-2.0 >= $GLIB_REQUIRED_VERSION) ], [AC_MSG_FAILURE([Value for --with-indicator-gtk was neither 2 nor 3])] ) -- cgit v1.2.3 From dcd64738bfb7a4060080526203fa68e9c176e48b Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 20 Mar 2012 17:10:57 -0500 Subject: Tabs vs. spaces cosmetic change in configure.ac. --- configure.ac | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 1690ad6..a429d17 100644 --- a/configure.ac +++ b/configure.ac @@ -59,8 +59,8 @@ AS_IF([test "x$with_gtk" = x3], indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION indicate-0.7 >= $INDICATE_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION - glib-2.0 >= $GLIB_REQUIRED_VERSION - gmodule-2.0 >= $GLIB_REQUIRED_VERSION) + glib-2.0 >= $GLIB_REQUIRED_VERSION + gmodule-2.0 >= $GLIB_REQUIRED_VERSION) ], [test "x$with_gtk" = x2], [PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION @@ -68,8 +68,8 @@ AS_IF([test "x$with_gtk" = x3], indicator-0.4 >= $INDICATOR_REQUIRED_VERSION indicate-0.7 >= $INDICATE_REQUIRED_VERSION dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION - glib-2.0 >= $GLIB_REQUIRED_VERSION - gmodule-2.0 >= $GLIB_REQUIRED_VERSION) + glib-2.0 >= $GLIB_REQUIRED_VERSION + gmodule-2.0 >= $GLIB_REQUIRED_VERSION) ], [AC_MSG_FAILURE([Value for --with-indicator-gtk was neither 2 nor 3])] ) -- cgit v1.2.3 From e4db178a1b250394c121760411d1c774e898ab25 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 20 Mar 2012 19:03:20 -0500 Subject: Chase-recommended simplification of test-inclusion autoconf. --- Makefile.am | 2 +- configure.ac | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index bef67bd..4d64e31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = \ data \ po -if BUILD_TESTS +if HAVE_GTEST SUBDIRS += \ test diff --git a/configure.ac b/configure.ac index a429d17..a5ca692 100644 --- a/configure.ac +++ b/configure.ac @@ -76,15 +76,6 @@ AS_IF([test "x$with_gtk" = x3], AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) -########################### -# Test Dependencies -########################### - -AC_ARG_ENABLE([tests], - AC_HELP_STRING([--disable-tests], [Disable test scripts and tools]),, - [enable_tests=auto]) -AM_CONDITIONAL(BUILD_TESTS, test xyes = xyes) - ########################### # Status Provider Deps ########################### @@ -126,6 +117,7 @@ AC_SUBST(COVERAGE_LDFLAGS) m4_include([m4/gtest.m4]) CHECK_GTEST +AM_CONDITIONAL([HAVE_GTEST], [test "x$have_gtest" = xyes]) ########################### # Check to see if we're local -- cgit v1.2.3 From 1985b73f61e084b60ed9f64de78f541f57059f9d Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 20 Mar 2012 19:14:04 -0500 Subject: Substituting build code under test lib for individual includes for example. --- test/Makefile.am | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index 8986a40..7d6d95e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -21,9 +21,6 @@ libgtest_a_CPPFLAGS = \ TESTS += test-gtest test_gtest_SOURCES = \ - $(top_srcdir)/src/launcher-menu-item.c \ - $(top_srcdir)/src/default-applications.c \ - $(top_srcdir)/src/seen-db.c \ test-gtest.cpp test_gtest_CPPFLAGS = \ $(APPLET_CFLAGS) \ @@ -31,6 +28,7 @@ test_gtest_CPPFLAGS = \ test_gtest_LDFLAGS = -pthread test_gtest_LDADD = \ $(APPLET_LIBS) \ + $(top_builddir)/src/.libs/libindicator-messages-status-provider.la \ libgtest.a -- cgit v1.2.3 From 0e5b8f77b3320b12f497153b7a781272aacac00a Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Wed, 21 Mar 2012 10:22:50 -0500 Subject: Reverted r268, restored BUILD_TESTS; ted explains upstream arch patch. --- Makefile.am | 2 +- configure.ac | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4d64e31..bef67bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = \ data \ po -if HAVE_GTEST +if BUILD_TESTS SUBDIRS += \ test diff --git a/configure.ac b/configure.ac index a5ca692..a429d17 100644 --- a/configure.ac +++ b/configure.ac @@ -76,6 +76,15 @@ AS_IF([test "x$with_gtk" = x3], AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) +########################### +# Test Dependencies +########################### + +AC_ARG_ENABLE([tests], + AC_HELP_STRING([--disable-tests], [Disable test scripts and tools]),, + [enable_tests=auto]) +AM_CONDITIONAL(BUILD_TESTS, test xyes = xyes) + ########################### # Status Provider Deps ########################### @@ -117,7 +126,6 @@ AC_SUBST(COVERAGE_LDFLAGS) m4_include([m4/gtest.m4]) CHECK_GTEST -AM_CONDITIONAL([HAVE_GTEST], [test "x$have_gtest" = xyes]) ########################### # Check to see if we're local -- cgit v1.2.3 From b90d0ebafe87759cf7de548d96a0744a16051e41 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 21 Mar 2012 15:20:15 -0500 Subject: Ensure that we're not distributing any gtest sources --- test/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index 7d6d95e..1d28dc4 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -7,8 +7,7 @@ TESTS = AM_CPPFLAGS = $(GTEST_CPPFLAGS) \ -I${top_srcdir}/src -nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc -libgtest_a_SOURCES = \ +nodist_libgtest_a_SOURCES = \ $(GTEST_SOURCE)/src/gtest-all.cc \ $(GTEST_SOURCE)/src/gtest_main.cc libgtest_a_CPPFLAGS = \ -- cgit v1.2.3 From 785195578165ab8add69dc0c23acef0997ac0482 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 21 Mar 2012 15:20:30 -0500 Subject: 0.5.94 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a429d17..4a7d1e0 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.93) +AM_INIT_AUTOMAKE(indicator-messages, 0.5.94) AM_MAINTAINER_MODE -- cgit v1.2.3 From ac858ff160ec3b22aeec64dfcc280a803aa34455 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 21 Mar 2012 15:31:03 -0500 Subject: debian/control: Adding dep on libgtest-dev --- debian/changelog | 3 ++- debian/control | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index b3eaafa..d60d539 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,9 @@ indicator-messages (0.5.94-0ubuntu1~ppa1) UNRELEASED; urgency=low * Fix i18n for description (LP: #957525) * Implementing initial testing * Fixing blacklists (LP: #939258) + * debian/control: Adding dep on libgtest-dev - -- Ted Gould Wed, 21 Mar 2012 15:28:19 -0500 + -- Ted Gould Wed, 21 Mar 2012 15:30:53 -0500 indicator-messages (0.5.93-0ubuntu2) precise; urgency=low diff --git a/debian/control b/debian/control index 40b8dd5..3a324ac 100644 --- a/debian/control +++ b/debian/control @@ -19,7 +19,8 @@ Build-Depends: debhelper (>= 5.0), libdbusmenu-glib-dev (>= 0.5.90), libdbusmenu-gtk-dev (>= 0.5.90), libdbusmenu-gtk3-dev (>= 0.5.90), - libtelepathy-glib-dev (>= 0.9.0) + libtelepathy-glib-dev (>= 0.9.0), + libgtest-dev Standards-Version: 3.9.2 Homepage: https://launchpad.net/indicator-messages Vcs-Bzr: http://code.launchpad.net/~ubuntu-desktop/indicator-messages/ubuntu -- cgit v1.2.3 From b6760ba8d8977c9ebbf0f49d427310bd8dd4d58d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 21 Mar 2012 15:33:26 -0500 Subject: releasing version 0.5.94-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index d60d539..e002874 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-messages (0.5.94-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-messages (0.5.94-0ubuntu1~ppa1) precise; urgency=low * New upstream release. * Fix for missing icons in the messaging menu (LP: #960553) @@ -7,7 +7,7 @@ indicator-messages (0.5.94-0ubuntu1~ppa1) UNRELEASED; urgency=low * Fixing blacklists (LP: #939258) * debian/control: Adding dep on libgtest-dev - -- Ted Gould Wed, 21 Mar 2012 15:30:53 -0500 + -- Ted Gould Wed, 21 Mar 2012 15:33:19 -0500 indicator-messages (0.5.93-0ubuntu2) precise; urgency=low -- cgit v1.2.3