-INCLUDES = -DG_LOG_DOMAIN=\"hildon-@API_VERSION_MAJOR@\" \
- -DLOCALEDIR=\"$(localedir)\"
-
-MAINTAINERCLEANFILES = Makefile.in \
- hildon-enum-types.c \
- hildon-enum-types.h \
- hildon-marshalers.h \
- hildon-marshalers.c
-
-EXTRA_DIST = hildon-marshalers.list
-
-lib_LTLIBRARIES = libhildon-@API_VERSION_MAJOR@.la
-
-libhildon_@API_VERSION_MAJOR@_la_LDFLAGS = $(HILDON_WIDGETS_LT_LDFLAGS)
-
-libhildon_@API_VERSION_MAJOR@_la_LIBADD = $(GTK_LIBS) \
- $(GCONF_LIBS) \
- $(ESD_LIBS) \
- @HILDON_LT_LDFLAGS@
-
-
-libhildon_@API_VERSION_MAJOR@_la_CFLAGS = $(GTK_CFLAGS) \
- $(GCONF_CFLAGS) \
- $(ESD_CFLAGS)
-
-libhildon_@API_VERSION_MAJOR@_la_SOURCES = hildon-private.c \
- hildon-controlbar.c \
- hildon-seekbar.c \
- hildon-note.c \
- hildon-volumebar.c \
- hildon-sound.c \
- hildon-volumebar-range.c \
- hildon-hvolumebar.c \
- hildon-vvolumebar.c \
- hildon-calendar-popup.c \
- hildon-date-editor.c \
- hildon-time-editor.c \
- hildon-time-picker.c \
- hildon-date-selector.c \
- hildon-time-selector.c \
- hildon-touch-selector.c \
- hildon-picker-dialog.c \
- hildon-picker-button.c \
- hildon-date-button.c \
- hildon-time-button.c \
- hildon-helper.c \
- hildon-weekday-picker.c \
- hildon-number-editor.c \
- hildon-range-editor.c \
- hildon-get-password-dialog.c \
- hildon-set-password-dialog.c \
- hildon-sort-dialog.c \
- hildon-font-selection-dialog.c \
- hildon-login-dialog.c \
- hildon-wizard-dialog.c \
- hildon-color-chooser.c \
- hildon-color-button.c \
- hildon-color-chooser-dialog.c \
- hildon-defines.c \
- hildon-find-toolbar.c \
- hildon-banner.c \
- hildon-caption.c \
- hildon-window.c \
- hildon-stackable-window.c \
- hildon-program.c \
- hildon-code-dialog.c \
- hildon-enum-types.c \
- hildon-marshalers.c \
- hildon-calendar.c \
- hildon-pannable-area.c \
- hildon-bread-crumb-trail.c \
- hildon-bread-crumb.c \
- hildon-bread-crumb-widget.c \
- hildon-app-menu.c \
- hildon-button.c \
- hildon-toggle-button.c \
- hildon-dialog.c
+INCLUDES = -DG_LOG_DOMAIN=\"hildon-@API_VERSION_MAJOR@\" \
+ -DLOCALEDIR=\"$(localedir)\"
+
+MAINTAINERCLEANFILES = \
+ Makefile.in \
+ hildon-enum-types.c \
+ hildon-enum-types.h \
+ hildon-marshalers.h \
+ hildon-marshalers.c
+
+EXTRA_DIST = hildon-marshalers.list
+
+lib_LTLIBRARIES = libhildon-@API_VERSION_MAJOR@.la
+
+libhildon_@API_VERSION_MAJOR@_la_LDFLAGS = $(HILDON_WIDGETS_LT_LDFLAGS)
+
+libhildon_@API_VERSION_MAJOR@_la_LIBADD = \
+ $(GTK_LIBS) \
+ $(GCONF_LIBS) \
+ $(CANBERRA_LIBS) \
+ @HILDON_LT_LDFLAGS@
+
+libhildon_@API_VERSION_MAJOR@_la_CFLAGS = \
+ $(GTK_CFLAGS) \
+ $(GCONF_CFLAGS) \
+ $(CANBERRA_CFLAGS)
+
+libhildon_@API_VERSION_MAJOR@_la_SOURCES = \
+ hildon-private.c \
+ hildon-controlbar.c \
+ hildon-seekbar.c \
+ hildon-note.c \
+ hildon-volumebar.c \
+ hildon-sound.c \
+ hildon-volumebar-range.c \
+ hildon-hvolumebar.c \
+ hildon-vvolumebar.c \
+ hildon-calendar-popup.c \
+ hildon-date-editor.c \
+ hildon-time-editor.c \
+ hildon-time-picker.c \
+ hildon-date-selector.c \
+ hildon-time-selector.c \
+ hildon-touch-selector.c \
+ hildon-picker-dialog.c \
+ hildon-picker-button.c \
+ hildon-date-button.c \
+ hildon-time-button.c \
+ hildon-helper.c \
+ hildon-weekday-picker.c \
+ hildon-number-editor.c \
+ hildon-range-editor.c \
+ hildon-get-password-dialog.c \
+ hildon-set-password-dialog.c \
+ hildon-sort-dialog.c \
+ hildon-font-selection-dialog.c \
+ hildon-login-dialog.c \
+ hildon-wizard-dialog.c \
+ hildon-color-chooser.c \
+ hildon-color-button.c \
+ hildon-color-chooser-dialog.c \
+ hildon-defines.c \
+ hildon-find-toolbar.c \
+ hildon-banner.c \
+ hildon-caption.c \
+ hildon-window.c \
+ hildon-stackable-window.c \
+ hildon-program.c \
+ hildon-code-dialog.c \
+ hildon-enum-types.c \
+ hildon-marshalers.c \
+ hildon-calendar.c \
+ hildon-pannable-area.c \
+ hildon-bread-crumb-trail.c \
+ hildon-bread-crumb.c \
+ hildon-bread-crumb-widget.c \
+ hildon-app-menu.c \
+ hildon-button.c \
+ hildon-toggle-button.c \
+ hildon-dialog.c
libhildon_@API_VERSION_MAJOR@_built_public_headers = \
- hildon-enum-types.h \
- hildon-marshalers.h
-
-libhildon_@API_VERSION_MAJOR@_includedir = $(includedir)/$(PACKAGE)-$(API_VERSION_MAJOR)/$(PACKAGE)
-
-libhildon_@API_VERSION_MAJOR@_public_headers = hildon-banner.h \
- hildon-calendar-popup.h \
- hildon-caption.h \
- hildon-code-dialog.h \
- hildon-color-button.h \
- hildon-color-chooser-dialog.h \
- hildon-color-chooser.h \
- hildon-controlbar.h \
- hildon-date-editor.h \
- hildon-defines.h \
- hildon-find-toolbar.h \
- hildon-helper.h \
- hildon-font-selection-dialog.h \
- hildon-get-password-dialog.h \
- hildon-hvolumebar.h \
- hildon-login-dialog.h \
- hildon-note.h \
- hildon-number-editor.h \
- hildon-program.h \
- hildon-range-editor.h \
- hildon-seekbar.h \
- hildon-set-password-dialog.h \
- hildon-sort-dialog.h \
- hildon-sound.h \
- hildon-time-editor.h \
- hildon-time-picker.h \
- hildon-date-selector.h \
- hildon-time-selector.h \
- hildon-touch-selector.h \
- hildon-picker-dialog.h \
- hildon-picker-button.h \
- hildon-date-button.h \
- hildon-time-button.h \
- hildon-volumebar-range.h \
- hildon-volumebar.h \
- hildon-vvolumebar.h \
- hildon-weekday-picker.h \
- hildon.h \
- hildon-window.h \
- hildon-stackable-window.h \
- hildon-wizard-dialog.h \
- hildon-calendar.h \
- hildon-pannable-area.h \
- hildon-bread-crumb-trail.h \
- hildon-bread-crumb.h \
- hildon-app-menu.h \
- hildon-dialog.h \
- hildon-button.h \
- hildon-toggle-button.h \
- hildon-version.h
-
-libhildon_@API_VERSION_MAJOR@_include_HEADERS = $(libhildon_@API_VERSION_MAJOR@_public_headers) \
- $(libhildon_@API_VERSION_MAJOR@_built_public_headers)
-
-noinst_HEADERS = hildon-banner-private.h \
- hildon-calendar-popup-private.h \
- hildon-private.h \
- hildon-caption-private.h \
- hildon-code-dialog-private.h \
- hildon-color-button-private.h \
- hildon-color-chooser-dialog-private.h \
- hildon-color-chooser-private.h \
- hildon-controlbar-private.h \
- hildon-date-editor-private.h \
- hildon-find-toolbar-private.h \
- hildon-font-selection-dialog-private.h \
- hildon-get-password-dialog-private.h \
- hildon-login-dialog-private.h \
- hildon-note-private.h \
- hildon-number-editor-private.h \
- hildon-program-private.h \
- hildon-range-editor-private.h \
- hildon-seekbar-private.h \
- hildon-set-password-dialog-private.h \
- hildon-sort-dialog-private.h \
- hildon-time-editor-private.h \
- hildon-time-picker-private.h \
- hildon-volumebar-private.h \
- hildon-weekday-picker-private.h \
- hildon-window-private.h \
- hildon-stackable-window-private.h \
- hildon-wizard-dialog-private.h \
- hildon-calendar-private.h \
- hildon-app-menu-private.h \
- hildon-bread-crumb-widget.h
+ hildon-enum-types.h \
+ hildon-marshalers.h
+
+libhildon_@API_VERSION_MAJOR@_includedir = \
+ $(includedir)/$(PACKAGE)-$(API_VERSION_MAJOR)/$(PACKAGE)
+
+libhildon_@API_VERSION_MAJOR@_public_headers = \
+ hildon-banner.h \
+ hildon-calendar-popup.h \
+ hildon-caption.h \
+ hildon-code-dialog.h \
+ hildon-color-button.h \
+ hildon-color-chooser-dialog.h \
+ hildon-color-chooser.h \
+ hildon-controlbar.h \
+ hildon-date-editor.h \
+ hildon-defines.h \
+ hildon-find-toolbar.h \
+ hildon-helper.h \
+ hildon-font-selection-dialog.h \
+ hildon-get-password-dialog.h \
+ hildon-hvolumebar.h \
+ hildon-login-dialog.h \
+ hildon-note.h \
+ hildon-number-editor.h \
+ hildon-program.h \
+ hildon-range-editor.h \
+ hildon-seekbar.h \
+ hildon-set-password-dialog.h \
+ hildon-sort-dialog.h \
+ hildon-sound.h \
+ hildon-time-editor.h \
+ hildon-time-picker.h \
+ hildon-date-selector.h \
+ hildon-time-selector.h \
+ hildon-touch-selector.h \
+ hildon-picker-dialog.h \
+ hildon-picker-button.h \
+ hildon-date-button.h \
+ hildon-time-button.h \
+ hildon-volumebar-range.h \
+ hildon-volumebar.h \
+ hildon-vvolumebar.h \
+ hildon-weekday-picker.h \
+ hildon.h \
+ hildon-window.h \
+ hildon-stackable-window.h \
+ hildon-wizard-dialog.h \
+ hildon-calendar.h \
+ hildon-pannable-area.h \
+ hildon-bread-crumb-trail.h \
+ hildon-bread-crumb.h \
+ hildon-app-menu.h \
+ hildon-dialog.h \
+ hildon-button.h \
+ hildon-toggle-button.h \
+ hildon-version.h
+
+libhildon_@API_VERSION_MAJOR@_include_HEADERS = \
+ $(libhildon_@API_VERSION_MAJOR@_public_headers) \
+ $(libhildon_@API_VERSION_MAJOR@_built_public_headers)
+
+noinst_HEADERS = hildon-banner-private.h \
+ hildon-calendar-popup-private.h \
+ hildon-private.h \
+ hildon-caption-private.h \
+ hildon-code-dialog-private.h \
+ hildon-color-button-private.h \
+ hildon-color-chooser-dialog-private.h \
+ hildon-color-chooser-private.h \
+ hildon-controlbar-private.h \
+ hildon-date-editor-private.h \
+ hildon-find-toolbar-private.h \
+ hildon-font-selection-dialog-private.h \
+ hildon-get-password-dialog-private.h \
+ hildon-login-dialog-private.h \
+ hildon-note-private.h \
+ hildon-number-editor-private.h \
+ hildon-program-private.h \
+ hildon-range-editor-private.h \
+ hildon-seekbar-private.h \
+ hildon-set-password-dialog-private.h \
+ hildon-sort-dialog-private.h \
+ hildon-time-editor-private.h \
+ hildon-time-picker-private.h \
+ hildon-volumebar-private.h \
+ hildon-weekday-picker-private.h \
+ hildon-window-private.h \
+ hildon-stackable-window-private.h \
+ hildon-wizard-dialog-private.h \
+ hildon-calendar-private.h \
+ hildon-app-menu-private.h \
+ hildon-bread-crumb-widget.h
# Don't build the library until we have built the header that it needs:
$(OBJECTS) $(libhildon_$(API_VERSION_MAJOR)_la_OBJECTS): hildon-enum-types.h hildon-marshalers.c hildon-marshalers.h
-hildon-enum-types.h: @REBUILD@ $(libhildon_$(API_VERSION_MAJOR)_public_headers) Makefile
- (cd $(srcdir) && glib-mkenums \
- --fhead "#ifndef __HILDON_ENUM_TYPES_H__\n" \
- --fhead "#define __HILDON_ENUM_TYPES_H__\n" \
- --fhead "\n" \
- --fhead "#include <glib-object.h>\n" \
- --fhead "\n" \
- --fhead "G_BEGIN_DECLS\n" \
- --fhead "\n" \
- --fprod "/* Enumerations from \"@filename@\" */\n" \
- --vhead "GType @enum_name@_get_type (void);\n#define HILDON_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
- --ftail "\nG_END_DECLS\n\n#endif /* __HILDON_ENUM_TYPES_H__ */" \
- $(libhildon_$(API_VERSION_MAJOR)_public_headers)) > $@
-
-hildon-enum-types.c: @REBUILD@ $(libhildon_$(API_VERSION_MAJOR)_public_headers) Makefile
- (cd $(srcdir) && glib-mkenums \
- --fhead "#include \"hildon.h\"\n" \
- --fhead "#include <glib-object.h>" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
- $(libhildon_$(API_VERSION_MAJOR)_public_headers)) > $@
-
-hildon-marshalers.h: hildon-marshalers.list
+hildon-enum-types.h: @REBUILD@ $(libhildon_$(API_VERSION_MAJOR)_public_headers) Makefile
+ (cd $(srcdir) && glib-mkenums \
+ --fhead "#ifndef __HILDON_ENUM_TYPES_H__\n" \
+ --fhead "#define __HILDON_ENUM_TYPES_H__\n" \
+ --fhead "\n" \
+ --fhead "#include <glib-object.h>\n" \
+ --fhead "\n" \
+ --fhead "G_BEGIN_DECLS\n" \
+ --fhead "\n" \
+ --fprod "/* Enumerations from \"@filename@\" */\n" \
+ --vhead "GType @enum_name@_get_type (void);\n#define HILDON_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
+ --ftail "\nG_END_DECLS\n\n#endif /* __HILDON_ENUM_TYPES_H__ */" \
+ $(libhildon_$(API_VERSION_MAJOR)_public_headers)) > $@
+
+hildon-enum-types.c: @REBUILD@ $(libhildon_$(API_VERSION_MAJOR)_public_headers) Makefile
+ (cd $(srcdir) && glib-mkenums \
+ --fhead "#include \"hildon.h\"\n" \
+ --fhead "#include <glib-object.h>" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
+ $(libhildon_$(API_VERSION_MAJOR)_public_headers)) > $@
+
+hildon-marshalers.h: hildon-marshalers.list
glib-genmarshal --prefix _hildon_marshal --header hildon-marshalers.list >hildon-marshalers.h
-hildon-marshalers.c: hildon-marshalers.list hildon-marshalers.h
+hildon-marshalers.c: hildon-marshalers.list hildon-marshalers.h
echo '#include "hildon-marshalers.h"' >hildon-marshalers.c
glib-genmarshal --prefix _hildon_marshal --body hildon-marshalers.list >>hildon-marshalers.c
/*
- * This file is a part of hildon
+ * This file is a part of libhildon
*
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
+ * Copyright (C) 2005-2008 Nokia Corporation. All rights reserved.
*
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ * Contact: Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
/**
* SECTION:hildon-sound
- * @short_description: An esd-based utility function for playing a sound.
+ * @short_description: libcanberra-based utility function for playing a sound.
*
*/
-#include "hildon-sound.h"
-#include <gconf/gconf-client.h>
-#include <esd.h>
-#include <unistd.h>
+#include "hildon-sound.h"
+#include <gconf/gconf-client.h>
+#include <canberra.h>
+#include <unistd.h>
-#define ALARM_GCONF_PATH \
- "/apps/osso/sound/system_alert_volume"
+#define ALARM_GCONF_PATH "/apps/osso/sound/system_alert_volume"
/**
* hildon_play_system_sound:
* @sample: sound file to play
*
- * Plays the given sample using esd sound daemon.
+ * Plays the given sample using libcanberra.
* Volume level is received from gconf.
*/
void
-hildon_play_system_sound (const gchar *sample)
+hildon_play_system_sound(const gchar *sample)
{
+ float volume = 0;
+ int ret;
+ ca_context *ca_con = NULL;
+ ca_proplist *pl = NULL;
+
+#if 0 /* FIXME: Check volume handling. Would be great not to use Gconf... */
GConfClient *client;
GConfValue *value;
- gint volume, scale, sock, sample_id;
+ gint gconf_vol;
+ /*
+ * The volume is from -0dB to -6dB,
+ The full volume is marked as 2 in gconf */
client = gconf_client_get_default ();
value = gconf_client_get (client, ALARM_GCONF_PATH, NULL);
/* We want error cases to match full volume, not silence, so
we do not want to use gconf_client_get_int */
if (!value || value->type != GCONF_VALUE_INT)
- volume = 2;
+ gconf_vol = 2;
else
- volume = gconf_value_get_int(value);
+ gconf_vol = gconf_value_get_int(value);
if (value)
gconf_value_free(value);
g_object_unref (client);
- switch (volume)
- {
- case 0:
- return;
- case 1:
- scale = 0x80;
- break;
- case 2:
- default:
- scale = 0xff;
- break;
- };
+ volume = ((1.0 - (float)gconf_vol / 2.0)) * (-6.0);
+#endif
- sock = esd_open_sound (NULL);
- if (sock <= 0)
+ if ((ret = ca_context_create(&ca_con)) != CA_SUCCESS) {
+ g_warning("ca_context_create: %s\n", ca_strerror(ret));
return;
-
- sample_id = esd_file_cache (sock, g_get_prgname(), sample);
- if (sample_id < 0) {
- close(sock);
+ }
+ if ((ret = ca_context_open(ca_con)) != CA_SUCCESS) {
+ g_warning("ca_context_open: %s\n", ca_strerror(ret));
+ ca_context_destroy(ca_con);
return;
}
+ ca_proplist_create(&pl);
+ ca_proplist_sets(pl, CA_PROP_MEDIA_FILENAME, sample);
+ ca_proplist_setf(pl, CA_PROP_CANBERRA_VOLUME, "%f", volume);
+
+ ret = ca_context_play_full(ca_con, 0, pl, NULL, NULL);
+ g_debug("ca_context_play_full (vol %f): %s\n", volume, ca_strerror(ret));
- esd_set_default_sample_pan (sock, sample_id, scale, scale);
- esd_sample_play(sock, sample_id);
- esd_sample_free(sock, sample_id);
- close (sock);
+ ca_proplist_destroy(pl);
+ ca_context_destroy(ca_con);
}