Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
notifications: fixed full/static builds, docs & travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
waht committed Mar 1, 2018
1 parent 13c267c commit 83c3d5c
Show file tree
Hide file tree
Showing 22 changed files with 129 additions and 160 deletions.
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ matrix:

# HASKELL: Only build Haskell binding and plugin

# - os: osx
# osx_image: xcode9.3beta
# compiler: clang
# env: [ HASKELL=ON ]
- os: osx
osx_image: xcode9.3beta
compiler: clang
env: [ HASKELL=ON ]

- os: linux
compiler: gcc
Expand Down Expand Up @@ -96,11 +96,11 @@ before_install:
brew install python3
# Since Qt 5.10.1 GCC is unable to compile the Qt-GUI under macOS printing the following error message:
# 'init_priority' attribute is not supported on this platform
#DISABLEDbrew install qt@5.5
#DISABLEDbrew install swig
#DISABLEDbrew install yajl
brew install qt@5.5
brew install swig
brew install yajl
pip2 install cheetah # Required by kdb-gen
# start dbus (session?) bus
# start D-Bus session bus
brew services start dbus
fi
- |
Expand Down Expand Up @@ -163,8 +163,8 @@ before_script:
cmake
-GNinja
-DBUILD_STATIC=OFF
-DPLUGINS="${plugins:-ALL;-jni;dbusrecv;internalnotification}"
-DBINDINGS="${bindings:-MAINTAINED;-EXPERIMENTAL;-DEPRECATED;-swig_ruby;io_uv}"
-DPLUGINS="${plugins:-ALL;-jni}"
-DBINDINGS="${bindings}"
-DENABLE_DEBUG=ON
-DTOOLS="${tools:-ALL;}"
-DINSTALL_SYSTEM_FILES=OFF
Expand Down
6 changes: 4 additions & 2 deletions doc/news/_preparation_next_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ You can also read the news [on our website](https://www.libelektra.org/news/0.8.

### Notification: New transport plugin

Elektra's notification feature has received its first transport plugin: D-Bus.
Elektra's notification feature has received its first transport plugin pair:
D-Bus.
Transport plugins provide a link between applications using Elektra.
These plugins send and receive notifications when a key is modified within the
key database.
Expand All @@ -53,7 +54,8 @@ The new `dbusrecv` plugin is responsible for receiving messages sent from the

For more details see the
[notification tutorial](https://github.com/ElektraInitiative/libelektra/tree/master/doc/tutorials/notifications.md)
or the [example applications](https://github.com/ElektraInitiative/libelektra/tree/master/src/libs/notification/example)
or the
[example applications](https://github.com/ElektraInitiative/libelektra/tree/master/src/libs/notification/example)

### <<HIGHLIGHT2>>

Expand Down
2 changes: 0 additions & 2 deletions src/bindings/io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ endif ()
#if (IS_INCLUDED)
# add_subdirectory (doc)
#endif ()

add_subdirectory (adapter)
79 changes: 0 additions & 79 deletions src/bindings/io/adapter/dbus/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/include/kdbnotificationinternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @ingroup kdbnotification
*
* @brief Elektra-Notification structures and declarations for developing
* notification plugins.
* notification and transport plugins.
*
* Only used by elektra-notification library, notification plugins (e.g.
* internalnotification) and transport plugins.
Expand Down
6 changes: 5 additions & 1 deletion src/libs/io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
file (GLOB SOURCES *.c)
set (SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/io.c"
)

set (LIBRARY_NAME elektra-io)

Expand All @@ -17,3 +19,5 @@ install (
FILES "${CMAKE_CURRENT_BINARY_DIR}/${LIBRARY_NAME}.pc"
DESTINATION lib${LIB_SUFFIX}/${TARGET_PKGCONFIG_FOLDER}
)

add_subdirectory (adapter)
File renamed without changes.
59 changes: 59 additions & 0 deletions src/libs/io/adapter/dbus/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
include (LibAddMacros)

find_package (DBus)

if (DBUS_FOUND)

set (ADAPTER_NAME dbus)

## Build library
set (ADAPTER_HDR_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/dbus.h"
)
set (ADAPTER_SRC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/dbus.c"
)

set (SOURCES ${ADAPTER_SRC_FILES} ${ADAPTER_HDR_FILES})

set (ADAPTER_LIBRARY elektra-io-adapter-${ADAPTER_NAME})

add_lib (io-adapter-${ADAPTER_NAME}
SOURCES ${SOURCES}
LINK_ELEKTRA
elektra-io
LINK_LIBRARIES
${DBUS_LIBRARIES}
)
target_include_directories (${ADAPTER_LIBRARY} SYSTEM PUBLIC ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})

if (BUILD_FULL OR BUILD_STATIC)
add_includes ("elektra-full" "${DBUS_INCLUDE_DIR};${DBUS_ARCH_INCLUDE_DIR}")
endif ()
#target_include_directories (${ADAPTER_LIBRARY} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

#target_compile_options (${ADAPTER_LIBRARY} PUBLIC ${LIBUV_CFLAGS_OTHER})
#target_link_elektra (${ADAPTER_LIBRARY} elektra-io ${DBUS_LIBRARIES})

#install (
# TARGETS ${ADAPTER_LIBRARY}
# LIBRARY DESTINATION lib${LIB_SUFFIX}
#)
#
# install (
# FILES ${ADAPTER_HDR_FILES}
# DESTINATION include/${TARGET_INCLUDE_FOLDER}
# )
#
# configure_file (
# "${CMAKE_CURRENT_SOURCE_DIR}/${ADAPTER_LIBRARY}.pc.in"
# "${CMAKE_CURRENT_BINARY_DIR}/${ADAPTER_LIBRARY}.pc"
# @ONLY
# )
#
# install (
# FILES "${CMAKE_CURRENT_BINARY_DIR}/${ADAPTER_LIBRARY}.pc"
# DESTINATION lib${LIB_SUFFIX}/${TARGET_PKGCONFIG_FOLDER}
# )

endif ()
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions src/libs/io/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@

#include <stdio.h>

// TODO remove before final commit
void debugKeySet (char * name, KeySet * ks)
{
printf ("Debug KeySet %s\n", name);
ksRewind (ks);
Key * current;
while ((current = ksNext (ks)) != NULL)
{
printf (" %s = %s\n", keyName (current), keyString (current));
}
ksRewind (ks);
}

void elektraIoSetBinding (KDB * kdb, ElektraIoInterface * ioBinding)
{
kdb->ioBinding = ioBinding;
Expand Down
6 changes: 3 additions & 3 deletions src/libs/notification/example/example_notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static volatile int keepRunning = 0;
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_BLUE "\x1b[34m"

void setTerminalColor (Key * color)
static void setTerminalColor (Key * color)
{
const char * value = keyString (color);
printf ("Callback called. Changing color to %s\n", value);
Expand All @@ -47,12 +47,12 @@ void setTerminalColor (Key * color)
}
}

void resetTerminalColor (void)
static void resetTerminalColor (void)
{
printf (ANSI_COLOR_RESET "\n");
}

void printKeyValue (KeySet * ks, Key * search, char * messageNotSet)
static void printKeyValue (KeySet * ks, Key * search, char * messageNotSet)
{
Key * found = ksLookup (ks, search, 0);
printf ("Key \"%s\"", keyName (search));
Expand Down
23 changes: 4 additions & 19 deletions src/libs/notification/example/example_notification_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_BLUE "\x1b[34m"

void setTerminalColor (Key * color)
static void setTerminalColor (Key * color)
{
const char * value = keyString (color);
printf ("Callback called. Changing color to %s\n", value);
Expand All @@ -48,35 +48,20 @@ void setTerminalColor (Key * color)
}
}

void resetTerminalColor (void)
static void resetTerminalColor (void)
{
printf (ANSI_COLOR_RESET "\n");
}

void printKeyValue (KeySet * ks, Key * search, char * messageNotSet)
{
Key * found = ksLookup (ks, search, 0);
printf ("Key \"%s\"", keyName (search));
if (!found)
{
printf (" not set. %s", messageNotSet);
}
else
{
printf (" has value \"%s\"", keyString (found));
}
printf ("\n");
}

void onSIGNAL (int signal)
static void onSIGNAL (int signal)
{
if (signal == SIGINT)
{
uv_stop (uv_default_loop ());
}
}

void printVariable (ElektraIoTimerOperation * timer)
static void printVariable (ElektraIoTimerOperation * timer)
{
int value = *(int *)elektraIoTimerGetData (timer);
printf ("\nMy integer value is %d\n", value);
Expand Down
22 changes: 19 additions & 3 deletions src/libs/notification/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @param placement Placement name
* @return Placement index or -1 on unknown placement name
*/
int placementToPosition (char * placement)
static int placementToPosition (char * placement)
{
if (strcmp (placement, "prerollback") == 0)
{
Expand Down Expand Up @@ -578,7 +578,7 @@ static int mountGlobalPlugin (KDB * kdb, Plugin * plugin)
* @retval 0 on errors
* @retval 1 on success
*/
int unmountGlobalPlugin (KDB * kdb, Plugin * plugin)
static int unmountGlobalPlugin (KDB * kdb, Plugin * plugin)
{
ELEKTRA_NOT_NULL (kdb);
ELEKTRA_NOT_NULL (plugin);
Expand Down Expand Up @@ -686,7 +686,23 @@ static void pluginsCloseNotification (KDB * kdb)
}
}

void elektraNotificationDoUpdate (Key * key, ElektraNotificationCallbackContext * context)
/**
* @internal
* Performs kdbGet to get updates for the changed key.
*
* The notification plugin (internalnotification) implicitly updates registered
* keys.
*
* NOTE This function might be moved to the internalnotification plugin to
* run kdbGet only for registered keys.
* Overrides through spec might be problematic however.
*
* @see ElektraNotificationChangeCallback (kdbnotificationinternal.h)
*
* @param key changed key
* @param context callback context
*/
static void elektraNotificationDoUpdate (Key * key, ElektraNotificationCallbackContext * context)
{
ELEKTRA_NOT_NULL (key);
ELEKTRA_NOT_NULL (context);
Expand Down
8 changes: 4 additions & 4 deletions src/libs/notification/tests/testlib_notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

int callback_called;

void test_openclose (void)
static void test_openclose (void)
{
printf ("test open & close\n");

Expand All @@ -39,7 +39,7 @@ void test_openclose (void)
keyDel (key);
}

void test_registerInt (void)
static void test_registerInt (void)
{
printf ("test elektraNotificationRegisterInt\n");

Expand Down Expand Up @@ -71,12 +71,12 @@ void test_registerInt (void)
keyDel (valueKey);
}

void testCallback (Key * key ELEKTRA_UNUSED)
static void testCallback (Key * key ELEKTRA_UNUSED)
{
callback_called = 1;
}

void test_registerCallback (void)
static void test_registerCallback (void)
{
printf ("test elektraNotificationRegisterCallback\n");

Expand Down
Loading

0 comments on commit 83c3d5c

Please sign in to comment.