diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.am.coverage | 41 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | src/im-menu-item.c | 40 | ||||
-rw-r--r-- | src/indicator-messages.c | 2 | ||||
-rw-r--r-- | src/messages-service.c | 1 | ||||
-rw-r--r-- | src/status-provider-telepathy.c | 2 |
7 files changed, 87 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index 6d4e4ee..45c511a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,5 +32,4 @@ dist-hook: echo Failed to generate AUTHORS: not a branch >&2; \ fi - 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 179d679..159c740 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.92) +AM_INIT_AUTOMAKE(indicator-messages, 0.5.93) AM_MAINTAINER_MODE @@ -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/src/im-menu-item.c b/src/im-menu-item.c index e7c0177..f07fff9 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -288,11 +288,47 @@ time_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateL return; } +/* Returns a newly allocated string which is 'str' with all occurences of + * consecutive whitespace collapsed into single space character. */ +static gchar * +collapse_whitespace (const gchar *str) +{ + GString *result; + gboolean in_space = FALSE; + + if (!str) + return NULL; + + result = g_string_sized_new (strlen (str)); + + while (*str) { + gunichar c = g_utf8_get_char_validated (str, -1); + + if (c < 0) + break; + + if (!g_unichar_isspace (c)) { + g_string_append_unichar (result, c); + in_space = FALSE; + } + else if (!in_space) { + g_string_append_c (result, ' '); + in_space = TRUE; + } + + str = g_utf8_next_char (str); + } + + return g_string_free (result, FALSE); +} + /* Callback from libindicate that is for getting the sender information on a particular indicator. */ static void sender_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const gchar * propertydata, gpointer data) { + gchar *label; + g_debug("Got Sender Information: %s", propertydata); ImMenuItem * self = IM_MENU_ITEM(data); @@ -310,7 +346,9 @@ sender_cb (IndicateListener * listener, IndicateListenerServer * server, Indicat return; } - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), INDICATOR_MENUITEM_PROP_LABEL, propertydata); + label = collapse_whitespace (propertydata); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), INDICATOR_MENUITEM_PROP_LABEL, label); + g_free (label); return; } diff --git a/src/indicator-messages.c b/src/indicator-messages.c index cf81f40..2c5e3cd 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -724,7 +724,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm gtk_widget_set_size_request(GTK_WIDGET (gmi), -1, height + 4); #if GTK_CHECK_VERSION(3, 0, 0) - gtk_widget_set_margin_left (hbox, width + 2 * padding); + gtk_widget_set_margin_left (hbox, width + padding); #endif GdkPixbuf * pixbuf = dbusmenu_menuitem_property_get_image(newitem, INDICATOR_MENUITEM_PROP_ICON); diff --git a/src/messages-service.c b/src/messages-service.c index a21435c..6e53d85 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -621,6 +621,7 @@ server_shortcut_added (AppMenuItem * appitem, DbusmenuMenuitem * mi, gpointer da g_debug("Application Shortcut added: %s", mi != NULL ? dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL) : "none"); DbusmenuMenuitem * shell = DBUSMENU_MENUITEM(data); if (mi != NULL) { + dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_ICON_NAME, ""); dbusmenu_menuitem_child_append(shell, mi); } resort_menu(shell); diff --git a/src/status-provider-telepathy.c b/src/status-provider-telepathy.c index c8e89da..948e965 100644 --- a/src/status-provider-telepathy.c +++ b/src/status-provider-telepathy.c @@ -290,7 +290,7 @@ set_status (StatusProvider * sp, StatusProviderStatus status) ret = dbus_g_proxy_call(priv->proxy, "GetPresence", &error, G_TYPE_INVALID, - G_TYPE_UINT, &priv->mc_status, + G_TYPE_UINT, &mcstatus, G_TYPE_INVALID); /* If we can't get the get call to work, let's not set */ |