aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am35
-rw-r--r--configure.ac21
-rw-r--r--data/com.canonical.indicator.sound.gschema.xml2
-rw-r--r--m4/gcov.m483
-rw-r--r--src/Makefile.am16
-rw-r--r--src/indicator-sound.c50
-rw-r--r--src/metadata-widget.c32
-rw-r--r--src/player-controller.vala4
-rw-r--r--src/sound-state-manager.c11
-rw-r--r--src/volume-widget.c1
10 files changed, 220 insertions, 35 deletions
diff --git a/Makefile.am b/Makefile.am
index 1742c47..b523736 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,3 +11,38 @@ EXTRA_DIST = \
DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
+
+# 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 5ee885a..22fffa1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(indicator-sound, 0.7.9.1, conor.curran@canonical.com)
+AC_INIT(indicator-sound, 0.8.0.0, conor.curran@canonical.com)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-sound, 0.7.9.1)
+AM_INIT_AUTOMAKE(indicator-sound, 0.8.0.0)
AM_MAINTAINER_MODE
@@ -89,15 +89,15 @@ AC_SUBST(APPLET_LIBS)
AC_SUBST(SOUNDSERVICE_CFLAGS)
AC_SUBST(SOUNDSERVICE_LIBS)
-AC_PATH_PROG(GCONFTOOL, gconftool-2)
-dnl Specify the gconf configuration source,
-dnl default to xml::$(sysconfdir)/gconf/gconf.xml.defaults
-
-AM_GCONF_SOURCE_2
+###########################
+# gcov coverage reporting
+###########################
-PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.0)
-AC_SUBST(GCONF_CFLAGS)
-AC_SUBST(GCONF_LIBS)
+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
@@ -198,4 +198,5 @@ SUS Indicator Configuration:
Prefix: $prefix
GTK+: $with_gtk
+ gcov: $use_gcov
])
diff --git a/data/com.canonical.indicator.sound.gschema.xml b/data/com.canonical.indicator.sound.gschema.xml
index 5d3fea8..ae0cc8d 100644
--- a/data/com.canonical.indicator.sound.gschema.xml
+++ b/data/com.canonical.indicator.sound.gschema.xml
@@ -11,7 +11,7 @@
</key>
<key name="interested-media-players" type="as">
<summary>A list of applications which at some point have registered with the sound menu</summary>
- <default>[ 'banshee' ]</default>
+ <default>[ 'rhythmbox' ]</default>
<description>
Each media player which abides by the MPRIS2 spec will automatically appear in the menu.
This array should contain the desktop file names (minus .desktop suffix) of applications which
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 e79f64e..36fe490 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,9 +28,14 @@ libsoundmenu_la_SOURCES = \
gen-sound-service.xml.c \
dbus-shared-names.h
-libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror -DG_LOG_DOMAIN=\"Indicator-Sound\"
+libsoundmenu_la_CFLAGS = \
+ $(APPLET_CFLAGS) \
+ $(COVERAGE_CFLAGS) \
+ -Wall -Werror -DG_LOG_DOMAIN=\"Indicator-Sound\"
libsoundmenu_la_LIBADD = $(APPLET_LIBS) -lm
-libsoundmenu_la_LDFLAGS = -module -avoid-version
+libsoundmenu_la_LDFLAGS =
+ $(COVERAGE_LDFLAGS) \
+ -module -avoid-version
checkxml: $(srcdir)/sound-service.xml
@@ -115,8 +120,13 @@ indicator_sound_service_SOURCES = \
sound-service-marshal.h \
$(music_bridge_VALASOURCES:.vala=.c)
-indicator_sound_service_CFLAGS = $(PULSEAUDIO_CFLAGS) $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall
+indicator_sound_service_CFLAGS = $(PULSEAUDIO_CFLAGS) \
+ $(SOUNDSERVICE_CFLAGS) \
+ $(GCONF_CFLAGS) \
+ $(COVERAGE_CFLAGS) \
+ -DLIBEXECDIR=\"$(libexecdir)\" -Wall
indicator_sound_service_LDADD = $(PULSEAUDIO_LIBS) $(SOUNDSERVICE_LIBS) $(GCONF_LIBS)
+indicator_sound_service_LDFLAGS = $(COVERAGE_LDFLAGS)
#########################
# Service xml compilation
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 7c72900..b953449 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -54,6 +54,7 @@ struct _IndicatorSoundPrivate
GList* transport_widgets_list;
GDBusProxy *dbus_proxy;
SoundStateManager* state_manager;
+ gchar *accessible_desc;
};
#define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate))
@@ -74,6 +75,7 @@ static GtkLabel * get_label (IndicatorObject * io);
static GtkImage * get_icon (IndicatorObject * io);
static GtkMenu * get_menu (IndicatorObject * io);
static const gchar * get_accessible_desc (IndicatorObject * io);
+static const gchar * get_name_hint (IndicatorObject * io);
static void indicator_sound_scroll (IndicatorObject * io,
IndicatorObjectEntry * entry, gint delta,
IndicatorScrollDirection direction);
@@ -133,6 +135,7 @@ indicator_sound_class_init (IndicatorSoundClass *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->entry_scrolled = indicator_sound_scroll;
io_class->secondary_activate = indicator_sound_middle_click;
}
@@ -152,6 +155,7 @@ indicator_sound_init (IndicatorSound *self)
GList* t_list = NULL;
priv->transport_widgets_list = t_list;
priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL);
+ priv->accessible_desc = NULL;
g_signal_connect ( G_OBJECT(self->service),
INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE,
@@ -168,17 +172,23 @@ indicator_sound_dispose (GObject *object)
g_object_unref(G_OBJECT(self->service));
self->service = NULL;
}
- g_list_free ( priv->transport_widgets_list );
+ g_list_free (priv->transport_widgets_list);
G_OBJECT_CLASS (indicator_sound_parent_class)->dispose (object);
- return;
}
static void
indicator_sound_finalize (GObject *object)
{
+ IndicatorSound * self = INDICATOR_SOUND(object);
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
+
+ if (priv->accessible_desc) {
+ g_free (priv->accessible_desc);
+ priv->accessible_desc = NULL;
+ }
+
G_OBJECT_CLASS (indicator_sound_parent_class)->finalize (object);
- return;
}
static GtkLabel *
@@ -233,14 +243,13 @@ static const gchar *
get_accessible_desc (IndicatorObject * io)
{
IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io);
-
- if (priv->volume_widget != NULL){
- return g_strdup_printf(_("Volume (%'.0f%%)"), volume_widget_get_current_volume(priv->volume_widget));
- }
-
- return NULL;
+ return priv->accessible_desc;
}
+static const gchar *get_name_hint (IndicatorObject * io)
+{
+ return PACKAGE_NAME;
+}
static void
connection_changed (IndicatorServiceManager * sm,
@@ -410,6 +419,9 @@ new_volume_slider_widget(DbusmenuMenuitem * newitem,
}
volume_widget = volume_widget_new (newitem, io);
priv->volume_widget = volume_widget;
+ // Don't forget to set the accessible desc.
+ update_accessible_desc (io);
+
GtkWidget* ido_slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget));
@@ -718,14 +730,15 @@ indicator_sound_scroll (IndicatorObject * io, IndicatorObjectEntry * entry,
//g_debug("indicator-sound-scroll - update slider with value %f", value);
volume_widget_update(VOLUME_WIDGET(priv->volume_widget), value, "scroll updates");
- sound_state_manager_show_notification (priv->state_manager, value);
+ if (!gtk_widget_get_mapped(GTK_WIDGET (entry->menu)))
+ sound_state_manager_show_notification (priv->state_manager, value);
}
static void
indicator_sound_middle_click (IndicatorObject * io, IndicatorObjectEntry * entry,
guint time, gpointer data)
{
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io);
g_return_if_fail (priv);
mute_widget_toggle(priv->mute_widget);
@@ -734,9 +747,22 @@ indicator_sound_middle_click (IndicatorObject * io, IndicatorObjectEntry * entry
void
update_accessible_desc (IndicatorObject * io)
{
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io);
GList *entries = indicator_object_get_entries(io);
IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data;
- entry->accessible_desc = get_accessible_desc(io);
+
+ gchar *old_desc = priv->accessible_desc;
+
+ if (priv->volume_widget) {
+ priv->accessible_desc = g_strdup_printf(_("Volume (%'.0f%%)"),
+ volume_widget_get_current_volume (priv->volume_widget));
+ }
+ else {
+ priv->accessible_desc = NULL;
+ }
+
+ entry->accessible_desc = priv->accessible_desc;
+ g_free (old_desc);
g_signal_emit(G_OBJECT(io),
INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
0,
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index 96d55ab..8d816de 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -127,9 +127,19 @@ metadata_widget_init (MetadataWidget *self)
GtkWidget *hbox;
GtkWidget *outer_v_box;
priv->icon_buf = NULL;
-
- outer_v_box = gtk_vbox_new (FALSE, 0);
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ outer_v_box = gtk_box_new (FALSE, 0);
+ #else
+ outer_v_box = gtk_vbox_new (FALSE, 0);
+ #endif
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new(FALSE, 0);
+ #else
hbox = gtk_hbox_new(FALSE, 0);
+ #endif
+
priv->meta_data_h_box = hbox;
priv->current_height = 1;
@@ -162,7 +172,13 @@ metadata_widget_init (MetadataWidget *self)
FALSE,
1);
priv->theme_change_occured = FALSE;
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ GtkWidget* vbox = gtk_box_new(FALSE, 0);
+ #else
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
+ #endif
+
// artist
GtkWidget* artist;
@@ -235,7 +251,11 @@ metadata_widget_dispose (GObject *object)
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(object));
if (priv->icon_buf != NULL){
- gdk_pixbuf_unref(priv->icon_buf);
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ g_object_unref(priv->icon_buf);
+ #else
+ gdk_pixbuf_unref(priv->icon_buf);
+ #endif
}
G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object);
}
@@ -756,7 +776,11 @@ metadata_widget_set_icon (MetadataWidget *self)
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
if (priv->icon_buf != NULL){
- gdk_pixbuf_unref(priv->icon_buf);
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ g_object_unref(priv->icon_buf);
+ #else
+ gdk_pixbuf_unref(priv->icon_buf);
+ #endif
priv->icon_buf = NULL;
}
diff --git a/src/player-controller.vala b/src/player-controller.vala
index 04d0bf9..05996c6 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -178,11 +178,11 @@ public class PlayerController : GLib.Object
playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE,
false );
this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE,
- this.app_info.get_id() == "banshee.desktop");
+ this.app_info.get_id() == "rhythmbox.desktop");
return;
}
metadata_menuitem.should_collapse (!this.custom_items[widget_order.METADATA].populated (MetadataMenuitem.relevant_attributes_for_ui()) );
- if (this.app_info.get_id() == "banshee.desktop"){
+ if (this.app_info.get_id() == "rhythmbox.desktop"){
TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem;
transport.handle_cached_action();
}
diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c
index d1c4cca..c6b14ca 100644
--- a/src/sound-state-manager.c
+++ b/src/sound-state-manager.c
@@ -80,8 +80,6 @@ sound_state_manager_init (SoundStateManager* self)
priv->settings_manager = g_settings_new("com.canonical.indicator.sound");
- sound_state_manager_notification_init (self);
-
sound_state_manager_prepare_state_image_names (self);
sound_state_manager_prepare_blocked_animation (self);
@@ -134,6 +132,13 @@ sound_state_manager_class_init (SoundStateManagerClass *klass)
static void
sound_state_manager_notification_init (SoundStateManager* self)
{
+ static gboolean initialized = FALSE;
+
+ /* one-time lazy initialization */
+ if (initialized)
+ return;
+ initialized = TRUE;
+
SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self);
if (!notify_init(PACKAGE_NAME))
@@ -164,6 +169,8 @@ sound_state_manager_show_notification (SoundStateManager *self,
{
SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self);
+ sound_state_manager_notification_init (self);
+
if (priv->notification == NULL ||
g_settings_get_boolean (priv->settings_manager, "show-notify-osd-on-scroll") == FALSE){
return;
diff --git a/src/volume-widget.c b/src/volume-widget.c
index e8e7bae..f2bf6ed 100644
--- a/src/volume-widget.c
+++ b/src/volume-widget.c
@@ -195,7 +195,6 @@ volume_widget_set_twin_item(VolumeWidget* self,
initial_level = 0;
}
gtk_range_set_value(range, initial_level);
- update_accessible_desc(priv->indicator);
}
static gboolean