From 94f68e08df92dd859889d08706fe1f024f4962e8 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 6 Dec 2011 19:31:29 -0600 Subject: Added coverage reporting via gcov config and targets. --- Makefile.am | 35 ++++++++++++++++++++++++ configure.ac | 11 ++++++++ m4/gcov.m4 | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 16 ++++++++--- 4 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 m4/gcov.m4 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..5303ccc 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,16 @@ PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.0) AC_SUBST(GCONF_CFLAGS) AC_SUBST(GCONF_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 ########################### @@ -198,4 +208,5 @@ SUS Indicator Configuration: Prefix: $prefix GTK+: $with_gtk + 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 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 -- cgit v1.2.3 From d2f3236301779a4b99a85083008b50fa6425eb26 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 5 Jan 2012 09:46:07 +0100 Subject: Lazily initialize notification daemon Avoid spawning notification daemon right at startup, instead initialize it lazily when actually doing a notification. Improves boot speed. https://blueprints.launchpad.net/ubuntu/+spec/desktop-p-desktop-boot-speed https://launchpad.net/bugs/912150 --- src/sound-state-manager.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c index c851407..ac03add 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.indicators.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; -- cgit v1.2.3 From 3a1bf21052b1f9939ef574a4dfa6d4c1fe74df5d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 10 Jan 2012 18:04:50 +0100 Subject: make indicator-sound's schema and path naming consistent with other indicators. indicator-sound uses a different schema prefix ("/com/canonical/indicators" vs "/com/canonical/indicator") and different path prefix ("/apps/indicators" vs "/com/canonical/indicator") than other indicators use. When I asked ronoc about the latter, he confirmed it's an error and suggested that the former be fixed at the same time to make indicator naming more consistent. --- data/Makefile.am | 2 +- data/com.canonical.indicator.sound.gschema.xml | 38 +++++++++++++++++++++++++ data/com.canonical.indicators.sound.gschema.xml | 38 ------------------------- data/indicator-sound.service.in | 2 +- src/dbus-shared-names.h | 8 +++--- src/familiar-players-db.vala | 2 +- src/metadata-menu-item.vala | 2 +- src/pulseaudio-mgr.c | 2 +- src/settings-manager.vala | 2 +- src/sound-service-dbus.c | 4 +-- src/sound-service.xml | 4 +-- src/sound-state-manager.c | 2 +- 12 files changed, 53 insertions(+), 53 deletions(-) create mode 100644 data/com.canonical.indicator.sound.gschema.xml delete mode 100644 data/com.canonical.indicators.sound.gschema.xml diff --git a/data/Makefile.am b/data/Makefile.am index f33b470..2891606 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = icons gsettings_SCHEMAS = \ - com.canonical.indicators.sound.gschema.xml + com.canonical.indicator.sound.gschema.xml @GSETTINGS_RULES@ dbus_servicesdir = $(DBUSSERVICEDIR) diff --git a/data/com.canonical.indicator.sound.gschema.xml b/data/com.canonical.indicator.sound.gschema.xml new file mode 100644 index 0000000..5d3fea8 --- /dev/null +++ b/data/com.canonical.indicator.sound.gschema.xml @@ -0,0 +1,38 @@ + + + + A list of applications blacklisted from the sound menu + [] + + 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 + do not want to be included in the sound menu. + + + + A list of applications which at some point have registered with the sound menu + [ 'banshee' ] + + 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 + have at some point appeared in the menU. This allows the menu remember and display offlined applications. + + + + false + Initial setting for global mute (mute all) on the menu + + On start up volume should not be muted. + + + + true + Initial setting for showing notify-osd notification on scroll volume-change + + When using the mouse scroll-wheel over the indicator-sound icon, the volume changes. + Enabling this setting, every scroll volume-change a notify-osd bubble with the + updated volume value will be shown (if supported by your notification daemon). + + + + diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml deleted file mode 100644 index dc63bcb..0000000 --- a/data/com.canonical.indicators.sound.gschema.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - A list of applications blacklisted from the sound menu - [] - - 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 - do not want to be included in the sound menu. - - - - A list of applications which at some point have registered with the sound menu - [ 'banshee' ] - - 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 - have at some point appeared in the menU. This allows the menu remember and display offlined applications. - - - - false - Initial setting for global mute (mute all) on the menu - - On start up volume should not be muted. - - - - true - Initial setting for showing notify-osd notification on scroll volume-change - - When using the mouse scroll-wheel over the indicator-sound icon, the volume changes. - Enabling this setting, every scroll volume-change a notify-osd bubble with the - updated volume value will be shown (if supported by your notification daemon). - - - - diff --git a/data/indicator-sound.service.in b/data/indicator-sound.service.in index a80cd03..4cee062 100644 --- a/data/indicator-sound.service.in +++ b/data/indicator-sound.service.in @@ -1,3 +1,3 @@ [D-BUS Service] -Name=com.canonical.indicators.sound +Name=com.canonical.indicator.sound Exec=@libexecdir@/indicator-sound-service diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h index 346a031..2517eb9 100644 --- a/src/dbus-shared-names.h +++ b/src/dbus-shared-names.h @@ -25,10 +25,10 @@ with this program. If not, see . #ifndef __DBUS_SHARED_NAMES_H__ #define __DBUS_SHARED_NAMES_H__ -#define INDICATOR_SOUND_DBUS_NAME "com.canonical.indicators.sound" -#define INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH "/com/canonical/indicators/sound/menu" -#define INDICATOR_SOUND_SERVICE_DBUS_OBJECT_PATH "/com/canonical/indicators/sound/service" -#define INDICATOR_SOUND_DBUS_INTERFACE "com.canonical.indicators.sound" +#define INDICATOR_SOUND_DBUS_NAME "com.canonical.indicator.sound" +#define INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH "/com/canonical/indicator/sound/menu" +#define INDICATOR_SOUND_SERVICE_DBUS_OBJECT_PATH "/com/canonical/indicator/sound/service" +#define INDICATOR_SOUND_DBUS_INTERFACE "com.canonical.indicator.sound" #define INDICATOR_SOUND_DBUS_VERSION 0 #define INDICATOR_SOUND_SIGNAL_STATE_UPDATE "SoundStateUpdate" diff --git a/src/familiar-players-db.vala b/src/familiar-players-db.vala index 96d690a..c47a35d 100644 --- a/src/familiar-players-db.vala +++ b/src/familiar-players-db.vala @@ -45,7 +45,7 @@ public class FamiliarPlayersDB : GLib.Object this.write_db(); } - this.dir_name = build_filename(get_user_cache_dir(), "indicators", "sound"); + this.dir_name = build_filename(get_user_cache_dir(), "indicator", "sound"); this.file_name = build_filename(this.dir_name, "familiar-players-db.keyfile"); if(create_key_file() && check_for_keys() && load_data_from_key_file()){ debug("keyfiles in place and ready for action"); diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 995d248..623aaf5 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -24,7 +24,7 @@ using Gdk; public class MetadataMenuitem : PlayerItem { - public const string ALBUM_ART_DIR_SUFFIX = "indicators/sound/album-art-cache"; + public const string ALBUM_ART_DIR_SUFFIX = "indicator/sound/album-art-cache"; public static string album_art_cache_dir; private static FetchFile fetcher; diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index ad6d34f..ba83c71 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -138,7 +138,7 @@ reconnect_to_pulse (gpointer user_data) "Indicator Sound"); pa_proplist_sets (proplist, PA_PROP_APPLICATION_ID, - "com.canonical.indicators.sound"); + "com.canonical.indicator.sound"); pa_proplist_sets (proplist, PA_PROP_APPLICATION_ICON_NAME, "multimedia-volume-control"); diff --git a/src/settings-manager.vala b/src/settings-manager.vala index 1b99cbc..a2be080 100644 --- a/src/settings-manager.vala +++ b/src/settings-manager.vala @@ -26,7 +26,7 @@ public class SettingsManager : GLib.Object public SettingsManager ( ){ } construct{ - this.settings = new Settings ("com.canonical.indicators.sound"); + this.settings = new Settings ("com.canonical.indicator.sound"); this.settings.changed["blacklisted-media-players"].connect (on_blacklist_event); } diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index b69f081..5650002 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -378,7 +378,7 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, gchar *str; GVariantBuilder builder; - our_settings = g_settings_new ("com.canonical.indicators.sound"); + our_settings = g_settings_new ("com.canonical.indicator.sound"); the_black_list = g_settings_get_value (our_settings, "blacklisted-media-players"); g_variant_iter_init (&iter, the_black_list); @@ -459,7 +459,7 @@ static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus *self, g_return_val_if_fail (player_name != NULL, FALSE); g_return_val_if_fail (IS_SOUND_SERVICE_DBUS (self), FALSE); - our_settings = g_settings_new ("com.canonical.indicators.sound"); + our_settings = g_settings_new ("com.canonical.indicator.sound"); the_black_list = g_settings_get_value (our_settings, "blacklisted-media-players"); g_variant_iter_init (&iter, the_black_list); diff --git a/src/sound-service.xml b/src/sound-service.xml index 796fa22..cb1d928 100644 --- a/src/sound-service.xml +++ b/src/sound-service.xml @@ -1,6 +1,6 @@ - - + + diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c index c851407..d1c4cca 100644 --- a/src/sound-state-manager.c +++ b/src/sound-state-manager.c @@ -78,7 +78,7 @@ sound_state_manager_init (SoundStateManager* self) priv->notification = NULL; priv->settings_manager = NULL; - priv->settings_manager = g_settings_new("com.canonical.indicators.sound"); + priv->settings_manager = g_settings_new("com.canonical.indicator.sound"); sound_state_manager_notification_init (self); -- cgit v1.2.3 From 3aefd6a19bf316bc7829658eecb3e01c2509982d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 11 Jan 2012 16:02:24 +0100 Subject: When creating indicator-sound's cache directory, use DirUtils.create_with_parents() instead of DirUtils.create(). Rationale described @ https://bugs.launchpad.net/indicator-sound/+bug/799383 --- src/metadata-menu-item.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 623aaf5..a7cbf46 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -62,8 +62,8 @@ public class MetadataMenuitem : PlayerItem private static string? create_album_art_temp_dir() { string path = GLib.Path.build_filename(Environment.get_user_cache_dir(), ALBUM_ART_DIR_SUFFIX); - if(DirUtils.create(path, 0700) == -1){ - warning("could not create a temp dir for remote album art, it must have been created already"); + if(DirUtils.create_with_parents(path, 0700) == -1){ + warning("could not create temp dir %s for remote album art, it must have been created already", path); } return path; } -- cgit v1.2.3 From 5f5d88054374dc00a0c28f9c91c849d70113e6ee Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 11 Jan 2012 17:11:32 +0100 Subject: fix minor runtime warning. The debug call in delete_album_art_contents() generates a runtime warning if the directory is empty. Moving the debug call to come after the "file == null" test silences the warning. --- src/metadata-menu-item.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index a7cbf46..42f9667 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -78,12 +78,12 @@ public class MetadataMenuitem : PlayerItem while (true) { var file = e.next_file (null); - - debug("file name = %s", file.get_name()); if (file == null) break; + debug("file name = %s", file.get_name()); + var child = dir.get_child (file.get_name ()); try { -- cgit v1.2.3 From 7808685f2462be4ff882f1390275968824b02fc6 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 13 Jan 2012 10:07:05 +0000 Subject: deprecated gtk fixes --- src/metadata-widget.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) 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; } -- cgit v1.2.3 From 1c6998b43f5bc0ea04b7285b2687b1b73393efd4 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 13 Jan 2012 13:04:08 +0000 Subject: revert to rhythmbox for the default player --- data/com.canonical.indicators.sound.gschema.xml | 2 +- src/player-controller.vala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/com.canonical.indicators.sound.gschema.xml b/data/com.canonical.indicators.sound.gschema.xml index dc63bcb..f853367 100644 --- a/data/com.canonical.indicators.sound.gschema.xml +++ b/data/com.canonical.indicators.sound.gschema.xml @@ -11,7 +11,7 @@ A list of applications which at some point have registered with the sound menu - [ 'banshee' ] + [ 'rhythmbox' ] 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/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(); } -- cgit v1.2.3 From 1bdef61d49c35e1476117ae80c99610296bab68c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 24 Jan 2012 20:11:12 -0600 Subject: fix minor memory leak detected by valgrind --- src/metadata-widget.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/metadata-widget.c b/src/metadata-widget.c index 8d816de..8304438 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -790,8 +790,9 @@ metadata_widget_set_icon (MetadataWidget *self) gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height); GString* banshee_string = g_string_new ( "banshee" ); - GString* app_panel = g_string_new ( g_utf8_strdown (dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME), - -1)); + gchar * tmp = g_utf8_strdown (dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME), -1); + GString* app_panel = g_string_new (tmp); + g_free (tmp); GdkPixbuf* icon_buf; // Banshee Special case! -- cgit v1.2.3 From f1fd627d976f56bd47e5b8226c229eaf8cc64158 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 24 Jan 2012 20:21:21 -0600 Subject: fix Free Memory Read error found by valgrind --- src/metadata-widget.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/metadata-widget.c b/src/metadata-widget.c index 8304438..16e30e5 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -256,6 +256,7 @@ metadata_widget_dispose (GObject *object) #else gdk_pixbuf_unref(priv->icon_buf); #endif + priv->icon_buf = NULL; } G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object); } -- cgit v1.2.3 From f174071dd8f98b298509d11f45b67dac77924599 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 24 Jan 2012 20:52:57 -0600 Subject: fix a minor memory leak reported by valigrind --- src/metadata-widget.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/metadata-widget.c b/src/metadata-widget.c index 16e30e5..a3383df 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -264,6 +264,10 @@ metadata_widget_dispose (GObject *object) static void metadata_widget_finalize (GObject *object) { + MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(object)); + g_string_free (priv->image_path, TRUE); + g_string_free (priv->old_image_path, TRUE); + G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object); } -- cgit v1.2.3 From 1e03cbb25bb86df7325d4909d9b3d5397b48e4cc Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 24 Jan 2012 20:54:05 -0600 Subject: fix hashtable leak reported by valgrind --- src/transport-widget.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/transport-widget.c b/src/transport-widget.c index 2d1a7f2..08e4ba9 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -269,6 +269,13 @@ transport_widget_dispose (GObject *object) } } #endif + + TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(object); + if (priv->command_coordinates != NULL) { + g_hash_table_destroy (priv->command_coordinates); + priv->command_coordinates = NULL; + } + G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object); } -- cgit v1.2.3 From 6101f59b28f94ebe2ac819c4af61928a0ff17844 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 24 Jan 2012 20:57:50 -0600 Subject: add visibility toggle support for (lp:#829648) --- data/com.canonical.indicator.sound.gschema.xml | 7 +++ src/indicator-sound.c | 66 +++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/data/com.canonical.indicator.sound.gschema.xml b/data/com.canonical.indicator.sound.gschema.xml index ae0cc8d..a3ec770 100644 --- a/data/com.canonical.indicator.sound.gschema.xml +++ b/data/com.canonical.indicator.sound.gschema.xml @@ -34,5 +34,12 @@ updated volume value will be shown (if supported by your notification daemon). + + true + Whether or not to show the sound indicator in the menu bar. + + Whether or not to show the sound indicator in the menu bar. + + diff --git a/src/indicator-sound.c b/src/indicator-sound.c index b953449..c87f850 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -55,10 +55,13 @@ struct _IndicatorSoundPrivate GDBusProxy *dbus_proxy; SoundStateManager* state_manager; gchar *accessible_desc; + GSettings *settings; }; #define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate)) +#define SOUND_INDICATOR_GSETTINGS_SCHEMA_ID "com.canonical.indicator.sound" + // GObject Boiler plate INDICATOR_SET_VERSION INDICATOR_SET_TYPE(INDICATOR_SOUND_TYPE) @@ -119,6 +122,10 @@ static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata); +// Visiblity +static void settings_init (IndicatorSound * self); + + static void indicator_sound_class_init (IndicatorSoundClass *klass) { @@ -156,6 +163,9 @@ indicator_sound_init (IndicatorSound *self) priv->transport_widgets_list = t_list; priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL); priv->accessible_desc = NULL; + priv->settings = NULL; + + settings_init (self); g_signal_connect ( G_OBJECT(self->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, @@ -168,6 +178,11 @@ indicator_sound_dispose (GObject *object) IndicatorSound * self = INDICATOR_SOUND(object); IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); + if (priv->settings != NULL) { + g_object_unref (G_OBJECT(priv->settings)); + priv->settings = NULL; + } + if (self->service != NULL) { g_object_unref(G_OBJECT(self->service)); self->service = NULL; @@ -747,10 +762,12 @@ 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); + if (!entries) + return; IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data; + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io); gchar *old_desc = priv->accessible_desc; if (priv->volume_widget) { @@ -770,3 +787,50 @@ update_accessible_desc (IndicatorObject * io) TRUE); g_list_free(entries); } + +/*** +**** +***/ + +#define VISIBLE_KEY "visible" + +static void +on_visible_changed (GSettings * settings, gchar * key, gpointer user_data) +{ + g_return_if_fail (!g_strcmp0 (key, VISIBLE_KEY)); + + IndicatorObject * io = INDICATOR_OBJECT(user_data); + const gboolean visible = g_settings_get_boolean (settings, key); + indicator_object_set_visible (io, visible); + if (visible) + update_accessible_desc (io); // requires an entry +} + +static void +settings_init (IndicatorSound *self) +{ + const char * schema = SOUND_INDICATOR_GSETTINGS_SCHEMA_ID; + + gint i; + gboolean schema_exists = FALSE; + const char * const * schemas = g_settings_list_schemas (); + for (i=0; !schema_exists && schemas && schemas[i]; i++) + if (!g_strcmp0 (schema, schemas[i])) + schema_exists = TRUE; + + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); + if (schema_exists) { + priv->settings = g_settings_new (schema); + } else { + priv->settings = NULL; + } + + if (priv->settings != NULL) { + g_signal_connect (G_OBJECT(priv->settings), "changed::" VISIBLE_KEY, + G_CALLBACK(on_visible_changed), self); + const gboolean b = g_settings_get_boolean (priv->settings, VISIBLE_KEY); + g_object_set (G_OBJECT(self), + "indicator-object-default-visibility", b, + NULL); + } +} -- cgit v1.2.3 From cc128bae27748bb4cc79fa232648e464befbc069 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 31 Jan 2012 21:15:46 -0600 Subject: Updating required dbusmenu gtk version --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 22fffa1..6b78c34 100644 --- a/configure.ac +++ b/configure.ac @@ -42,7 +42,7 @@ AC_ARG_WITH([gtk], GTK_REQUIRED_VERSION=2.22 GTK3_REQUIRED_VERSION=3.0 INDICATOR_REQUIRED_VERSION=0.3.19 -DBUSMENUGTK_REQUIRED_VERSION=0.3.101 +DBUSMENUGTK_REQUIRED_VERSION=0.5.90 POLKIT_REQUIRED_VERSION=0.92 PULSE_AUDIO_REQUIRED_VERSION=0.9.19 INDICATOR_DISPLAY_OBJECTS=0.1.11 -- cgit v1.2.3 From 1651821c9c51c3d26afce0dae583fc93fbf03cbb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 31 Jan 2012 21:20:44 -0600 Subject: Fixing includes to not have the '3' on them --- src/indicator-sound.c | 4 ---- src/metadata-widget.h | 4 ---- src/mute-widget.h | 4 ---- src/transport-widget.h | 4 ---- src/voip-input-widget.h | 4 ---- src/volume-widget.h | 4 ---- 6 files changed, 24 deletions(-) diff --git a/src/indicator-sound.c b/src/indicator-sound.c index c87f850..243e759 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -23,11 +23,7 @@ with this program. If not, see . #include #include #include -#if GTK_CHECK_VERSION(3, 0, 0) -#include -#else #include -#endif #include #include diff --git a/src/metadata-widget.h b/src/metadata-widget.h index b0123a3..fc6944e 100644 --- a/src/metadata-widget.h +++ b/src/metadata-widget.h @@ -20,11 +20,7 @@ with this program. If not, see . #define __METADATA_WIDGET_H__ #include -#if GTK_CHECK_VERSION(3, 0, 0) -#include -#else #include -#endif G_BEGIN_DECLS diff --git a/src/mute-widget.h b/src/mute-widget.h index 95130a1..88ddd41 100644 --- a/src/mute-widget.h +++ b/src/mute-widget.h @@ -22,11 +22,7 @@ with this program. If not, see . #include #include #include -#if GTK_CHECK_VERSION(3, 0, 0) -#include -#else #include -#endif #include G_BEGIN_DECLS diff --git a/src/transport-widget.h b/src/transport-widget.h index 8c2ce48..b68845f 100644 --- a/src/transport-widget.h +++ b/src/transport-widget.h @@ -20,11 +20,7 @@ with this program. If not, see . #define __TRANSPORT_WIDGET_H__ #include -#if GTK_CHECK_VERSION(3, 0, 0) -#include -#else #include -#endif #include "common-defs.h" diff --git a/src/voip-input-widget.h b/src/voip-input-widget.h index 0e90665..72da80c 100644 --- a/src/voip-input-widget.h +++ b/src/voip-input-widget.h @@ -22,11 +22,7 @@ with this program. If not, see . #include #include #include -#if GTK_CHECK_VERSION(3, 0, 0) -#include -#else #include -#endif G_BEGIN_DECLS diff --git a/src/volume-widget.h b/src/volume-widget.h index 3deb99c..665f39b 100644 --- a/src/volume-widget.h +++ b/src/volume-widget.h @@ -22,11 +22,7 @@ with this program. If not, see . #include #include #include -#if GTK_CHECK_VERSION(3, 0, 0) -#include -#else #include -#endif #include G_BEGIN_DECLS -- cgit v1.2.3 From 7599f9d6aa4b4b81158ffed3455ea9be760816ea Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 13 Feb 2012 20:08:02 +0000 Subject: tidy up --- src/volume-widget.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/volume-widget.c b/src/volume-widget.c index f2bf6ed..bd68eb3 100644 --- a/src/volume-widget.c +++ b/src/volume-widget.c @@ -78,7 +78,6 @@ volume_widget_class_init (VolumeWidgetClass *klass) static void volume_widget_init (VolumeWidget *self) { - //g_debug("VolumeWidget::volume_widget_init"); VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self); priv->ido_volume_slider = ido_scale_menu_item_new_with_range ("VOLUME", IDO_RANGE_STYLE_DEFAULT, 0, 0, 100, 1); -- cgit v1.2.3 From bd884a0a4b3a64c2f8d6757a0598993ee9297eef Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 13 Feb 2012 20:44:06 +0000 Subject: bump for release --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6b78c34..014cd1d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(indicator-sound, 0.8.0.0, conor.curran@canonical.com) +AC_INIT(indicator-sound, 0.8.1.0, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.8.0.0) +AM_INIT_AUTOMAKE(indicator-sound, 0.8.1.0) AM_MAINTAINER_MODE -- cgit v1.2.3