diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CMakeLists.txt | 4 | ||||
-rw-r--r-- | plugins/notification-sound/CMakeLists.txt | 28 | ||||
-rw-r--r-- | plugins/notification-sound/src/plugin.vala | 20 | ||||
-rw-r--r-- | plugins/notification-sound/src/register_plugin.vala | 3 |
4 files changed, 55 insertions, 0 deletions
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 10506a86..79523b8f 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -11,3 +11,7 @@ endif(PLUGIN_ENABLED_omemo) if(PLUGIN_ENABLED_http-files) add_subdirectory(http-files) endif(PLUGIN_ENABLED_http-files) + +if(PLUGIN_ENABLED_notification-sound) + add_subdirectory(notification-sound) +endif(PLUGIN_ENABLED_notification-sound) diff --git a/plugins/notification-sound/CMakeLists.txt b/plugins/notification-sound/CMakeLists.txt new file mode 100644 index 00000000..85963d25 --- /dev/null +++ b/plugins/notification-sound/CMakeLists.txt @@ -0,0 +1,28 @@ +find_packages(NOTIFICATION_SOUND_PACKAGES REQUIRED + Canberra + Gee + GLib + GModule + GObject + GDKPixbuf2 +) + +vala_precompile(NOTIFICATION_SOUND_VALA_C +SOURCES + src/plugin.vala + src/register_plugin.vala +CUSTOM_VAPIS + ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi + ${CMAKE_BINARY_DIR}/exports/dino.vapi + ${CMAKE_BINARY_DIR}/exports/qlite.vapi +PACKAGES + ${NOTIFICATION_SOUND_PACKAGES} +) + +add_definitions(${VALA_CFLAGS}) +add_library(notification-sound SHARED ${NOTIFICATION_SOUND_VALA_C}) +target_link_libraries(notification-sound libdino ${NOTIFICATION_SOUND_PACKAGES}) +set_target_properties(notification-sound PROPERTIES PREFIX "") +set_target_properties(notification-sound PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/) + +install(TARGETS notification-sound ${PLUGIN_INSTALL}) diff --git a/plugins/notification-sound/src/plugin.vala b/plugins/notification-sound/src/plugin.vala new file mode 100644 index 00000000..ba251434 --- /dev/null +++ b/plugins/notification-sound/src/plugin.vala @@ -0,0 +1,20 @@ +namespace Dino.Plugins.NotificationSound { + +public class Plugin : RootInterface, Object { + + public Dino.Application app; + private Canberra.Context sound_context; + + public void registered(Dino.Application app) { + this.app = app; + Canberra.Context.create(out sound_context); + + app.stream_interactor.get_module(NotificationEvents.IDENTITY).notify_message.connect((message, conversation) => { + sound_context.play(0, Canberra.PROP_EVENT_ID, "message-new-instant", Canberra.PROP_EVENT_DESCRIPTION, "New Dino message"); + }); + } + + public void shutdown() { } +} + +} diff --git a/plugins/notification-sound/src/register_plugin.vala b/plugins/notification-sound/src/register_plugin.vala new file mode 100644 index 00000000..09204c0f --- /dev/null +++ b/plugins/notification-sound/src/register_plugin.vala @@ -0,0 +1,3 @@ +public Type register_plugin(Module module) { + return typeof (Dino.Plugins.NotificationSound.Plugin); +} |