![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package libgaminggear for openSUSE:Factory checked in at 2014-07-11 20:06:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libgaminggear (Old) and /work/SRC/openSUSE:Factory/.libgaminggear.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libgaminggear" Changes: -------- --- /work/SRC/openSUSE:Factory/libgaminggear/libgaminggear.changes 2014-06-24 22:47:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libgaminggear.new/libgaminggear.changes 2014-07-11 20:06:10.000000000 +0200 @@ -1,0 +2,5 @@ +Sat Jul 5 12:33:51 UTC 2014 - mailaender@opensuse.org + +- update to version 0.4.0 + +------------------------------------------------------------------- Old: ---- libgaminggear-0.3.0.tar.bz2 New: ---- libgaminggear-0.4.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libgaminggear.spec ++++++ --- /var/tmp/diff_new_pack.p8CzDZ/_old 2014-07-11 20:06:11.000000000 +0200 +++ /var/tmp/diff_new_pack.p8CzDZ/_new 2014-07-11 20:06:11.000000000 +0200 @@ -17,7 +17,7 @@ %define majorversion 0 -%define minorversion 3 +%define minorversion 4 %define microversion 0 Name: libgaminggear Version: %{majorversion}.%{minorversion}.%{microversion} @@ -33,6 +33,9 @@ BuildRequires: pkg-config BuildRequires: xz BuildRequires: pkgconfig(gtk+-2.0) >= 2.20 +BuildRequires: pkgconfig(gudev-1.0) +BuildRequires: pkgconfig(libcanberra) +BuildRequires: pkgconfig(libnotify) BuildRequires: pkgconfig(sqlite3) >= 3.7 Requires(pre): %fillup_prereq BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ libgaminggear-0.3.0.tar.bz2 -> libgaminggear-0.4.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/CMakeLists.txt new/libgaminggear-0.4.0/CMakeLists.txt --- old/libgaminggear-0.3.0/CMakeLists.txt 2014-06-05 15:41:06.000000000 +0200 +++ new/libgaminggear-0.4.0/CMakeLists.txt 2014-07-04 14:37:43.000000000 +0200 @@ -22,7 +22,9 @@ INCLUDE(INSTALL_PKGCONFIGDIR) INCLUDE(UINPUT) +FIND_PACKAGE(CANBERRA REQUIRED) FIND_PACKAGE(GTK REQUIRED) +FIND_PACKAGE(NOTIFY REQUIRED) FIND_PACKAGE(SQLITE3 3.7) CONFIGURE_FILE( @@ -35,13 +37,15 @@ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") SET(V_MAJOR 0) -SET(V_MINOR 3) +SET(V_MINOR 4) SET(V_MICRO 0) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include + ${CANBERRA_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS} + ${NOTIFY_INCLUDE_DIRS} ) ADD_SUBDIRECTORY(configuration) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/Changelog new/libgaminggear-0.4.0/Changelog --- old/libgaminggear-0.3.0/Changelog 2014-06-05 15:41:06.000000000 +0200 +++ new/libgaminggear-0.4.0/Changelog 2014-07-04 14:37:43.000000000 +0200 @@ -1,3 +1,7 @@ +0.4.0 2014-07-04 + + * Added GaminggearAudioNotificator and GaminggearScreenNotificator + 0.3.0 2014-06-05 * Added WITHOUT_DOC build option @@ -13,4 +17,4 @@ 0.1.0 2014-04-13 * initial version - \ No newline at end of file + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/cmake_modules/FindCANBERRA.cmake new/libgaminggear-0.4.0/cmake_modules/FindCANBERRA.cmake --- old/libgaminggear-0.3.0/cmake_modules/FindCANBERRA.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/cmake_modules/FindCANBERRA.cmake 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,28 @@ +# Stefan Achatz 2012 +# +# Tries to find libcanberra and sets following variables according to found capabilities: +# +# CANBERRA_FOUND +# CANBERRA_INCLUDE_DIRS +# CANBERRA_LIBRARIES + +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PKG_CANBERRA libcanberra) + +FIND_PATH(CANBERRA_INCLUDE_DIRS canberra.h + HINTS + ${PKG_CANBERRA_INCLUDE_DIRS} + ${PKG_CANBERRA_INCLUDEDIR} +) + +FIND_LIBRARY(CANBERRA_LIBRARIES canberra + HINTS ${PKG_CANBERRA_LIBRARY_DIRS} +) + +IF(CANBERRA_LIBRARIES AND CANBERRA_INCLUDE_DIRS) + SET(CANBERRA_FOUND true) +ENDIF() + +IF(CANBERRA_FIND_REQUIRED AND NOT CANBERRA_FOUND) + MESSAGE(FATAL_ERROR "Could not find CANBERRA") +ENDIF() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/cmake_modules/FindNOTIFY.cmake new/libgaminggear-0.4.0/cmake_modules/FindNOTIFY.cmake --- old/libgaminggear-0.3.0/cmake_modules/FindNOTIFY.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/cmake_modules/FindNOTIFY.cmake 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,46 @@ +# Stefan Achatz 2012 +# +# Tries to find libnotify and sets following variables according to found capabilities: +# +# NOTIFY_FOUND +# NOTIFY_INCLUDE_DIRS +# NOTIFY_LIBRARIES +# HAVE_NOTIFY_0_7 + +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PKG_NOTIFY libnotify) + +FIND_PATH(NOTIFY_INCLUDE_DIRS libnotify/notify.h + HINTS + ${PKG_NOTIFY_INCLUDE_DIRS} + ${PKG_NOTIFY_INCLUDEDIR} +) + +FIND_LIBRARY(NOTIFY_LIBRARIES notify + HINTS ${PKG_NOTIFY_LIBRARY_DIRS} +) + +IF(NOTIFY_LIBRARIES AND NOTIFY_INCLUDE_DIRS) + SET(NOTIFY_FOUND true) +ENDIF() + +IF(NOTIFY_FIND_REQUIRED AND NOT NOTIFY_FOUND) + MESSAGE(FATAL_ERROR "Could not find NOTIFY") +ENDIF() + +FIND_PACKAGE(GTK) + +IF(NOTIFY_FOUND AND GTK_FOUND) + SET(INCLUDE_DIRS ${GTK_INCLUDE_DIRS} ${NOTIFY_INCLUDE_DIRS}) + SET(LINK_LIBS ${GTK_LIBRARIES} ${NOTIFY_LIBRARIES}) + + TRY_COMPILE(HAVE_NOTIFY_0_7 + "${CMAKE_BINARY_DIR}" + "${CMAKE_SOURCE_DIR}/cmake_modules/test_notify_0_7.c" + CMAKE_FLAGS + "-DINCLUDE_DIRECTORIES:STRING=${INCLUDE_DIRS}" + "-DLINK_LIBRARIES:STRING=${LINK_LIBS}" + OUTPUT_VARIABLE OUTPUT + ) +ENDIF() + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/cmake_modules/test_notify_0_7.c new/libgaminggear-0.4.0/cmake_modules/test_notify_0_7.c --- old/libgaminggear-0.3.0/cmake_modules/test_notify_0_7.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/cmake_modules/test_notify_0_7.c 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,6 @@ +#include <libnotify/notify.h> +int main() { + /* this wouldn't run, just needs to compile */ + notify_notification_new(NULL, NULL, NULL); + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/include/config.h.in new/libgaminggear-0.4.0/include/config.h.in --- old/libgaminggear-0.3.0/include/config.h.in 2014-06-05 15:41:06.000000000 +0200 +++ new/libgaminggear-0.4.0/include/config.h.in 2014-07-04 14:37:43.000000000 +0200 @@ -21,5 +21,6 @@ #define GAMINGGEAR_ICON_PATH "${CMAKE_INSTALL_PREFIX}/share/gaminggear/icons" #define UINPUT_DIR "${UINPUTDIR}" #cmakedefine SQLITE3_FOUND +#cmakedefine HAVE_NOTIFY_0_7 #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/include/gaminggear/CMakeLists.txt new/libgaminggear-0.4.0/include/gaminggear/CMakeLists.txt --- old/libgaminggear-0.3.0/include/gaminggear/CMakeLists.txt 2014-06-05 15:41:06.000000000 +0200 +++ new/libgaminggear-0.4.0/include/gaminggear/CMakeLists.txt 2014-07-04 14:37:43.000000000 +0200 @@ -23,6 +23,7 @@ INSTALL( FILES + audio_notificator.h evdev.h gaminggear_device.h gaminggear_hscale.h @@ -38,6 +39,7 @@ key_translations.h macro.h macro_threads.h + screen_notificator.h threads.h DESTINATION include/gaminggear-${V_MAJOR}/gaminggear ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/include/gaminggear/audio_notificator.h new/libgaminggear-0.4.0/include/gaminggear/audio_notificator.h --- old/libgaminggear-0.3.0/include/gaminggear/audio_notificator.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/include/gaminggear/audio_notificator.h 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,81 @@ +#ifndef __GAMINGGEAR_AUDIO_NOTIFICATOR__ +#define __GAMINGGEAR_AUDIO_NOTIFICATOR__ + +/* + * This file is part of libgaminggear. + * + * libgaminggear is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * libgaminggear is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libgaminggear. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <glib.h> + +G_BEGIN_DECLS + +typedef struct _GaminggearAudioNotificator GaminggearAudioNotificator; +typedef struct _GaminggearAudioNotification GaminggearAudioNotification; + +/*! \brief Initializes an audio notificator. + * + * The nomenclature init/deinit means there is only one instance of this object + * supported by an application. + * + * \param app_name The name of the binary. + * \param version_string Version of the binary. + * \param sound_driver "alsa" or "pulse". + * \retval notificator A new notificator object to be freed with \c gaminggear_audio_notificator_deinit() + * or \c NULL on error. + * \since 1.0 + */ +GaminggearAudioNotificator *gaminggear_audio_notificator_init(gchar const *app_name, gchar const *version_string, gchar const *sound_driver); + +/*! \brief Frees an existing notificator. + * \param notificator The notificator to be freed. + * \since 1.0 + */ +void gaminggear_audio_notificator_deinit(GaminggearAudioNotificator *notificator); + +/*! \brief Create new notification. + * \param notificator A notificator. + * \retval notification A new notification to be freed with \c gaminggear_audio_notification_free(). + * \since 1.0 + */ +GaminggearAudioNotification *gaminggear_audio_notification_new(GaminggearAudioNotificator *notificator); + +/*! \brief Frees an existing notification. + * \param notification The notification to be freed. + * \since 1.0 + */ +void gaminggear_audio_notification_free(GaminggearAudioNotification *notification); + +/*! \brief Play a sound file as notification. + * + * A already running playback is cancelled before the new file is played. + * \param notification The notification that plays the sound. + * \param filename The full path of the file to play. + * \param volume The playback volume in dB. + * \retval bool \c TRUE on success, else \c FALSE. + * \since 1.0 + */ +gboolean gaminggear_audio_notification_update(GaminggearAudioNotification *notification, gchar const *filename, gdouble volume); + +/*! \brief Cancel a running notification. + * \param notification Notification to be cancelled. + * \retval bool \c TRUE on success, else \c FALSE. + * \since 1.0 + */ +gboolean gaminggear_audio_notification_cancel(GaminggearAudioNotification *notification); + +G_END_DECLS + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/include/gaminggear/gaminggear_device.h new/libgaminggear-0.4.0/include/gaminggear/gaminggear_device.h --- old/libgaminggear-0.3.0/include/gaminggear/gaminggear_device.h 2014-06-05 15:41:06.000000000 +0200 +++ new/libgaminggear-0.4.0/include/gaminggear/gaminggear_device.h 2014-07-04 14:37:43.000000000 +0200 @@ -49,11 +49,12 @@ /*! \brief Creates new GaminggearDevice. * \param identifier The unique identifier of the device. + * \param vendor_id The vendor id of the device. * \param product_id The product id of the device. * \retval device The new GaminggearDevice which should be freed with g_object_unref(). * \since 1.0 */ -GaminggearDevice *gaminggear_device_new(gchar const *identifier, guint product_id); +GaminggearDevice *gaminggear_device_new(gchar const *identifier, guint vendor_id, guint product_id); /*! \brief Get identifier. * \param gaminggear_dev A GaminggearDevice. @@ -69,6 +70,22 @@ */ guint gaminggear_device_get_product_id(GaminggearDevice const *gaminggear_dev); +/*! \brief Get vendor id. + * \param gaminggear_dev A GaminggearDevice. + * \retval vendor_id The vendor id given at construction time. + * \since 1.0 + */ +guint gaminggear_device_get_vendor_id(GaminggearDevice const *gaminggear_dev); + +/*! \brief Match device agains vendor/product id + * \param gaminggear_dev A GaminggearDevice. + * \param vendor_id The vendor id to match against. + * \param product_id The product id to match against. + * \retval bool \c TRUE if vendor and product ids match, else \c FALSE. + * \since 1.0 + */ +gboolean gaminggear_device_matches(GaminggearDevice const *gaminggear_dev, guint vendor_id, guint product_id); + /*! \brief Open file. * * Once successfully opened, the file descriptor is stored and just returned on diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/include/gaminggear/screen_notificator.h new/libgaminggear-0.4.0/include/gaminggear/screen_notificator.h --- old/libgaminggear-0.3.0/include/gaminggear/screen_notificator.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/include/gaminggear/screen_notificator.h 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,93 @@ +#ifndef __GAMINGGEAR_SCREEN_NOTIFICATOR__ +#define __GAMINGGEAR_SCREEN_NOTIFICATOR__ + +/* + * This file is part of libgaminggear. + * + * libgaminggear is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * libgaminggear is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libgaminggear. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <glib.h> + +G_BEGIN_DECLS + +typedef struct _GaminggearScreenNotificator GaminggearScreenNotificator; +typedef struct _GaminggearScreenNotification GaminggearScreenNotification; + +/*! \brief Initializes an screen notificator. + * + * The nomenclature init/deinit means there is only one instance of this object + * supported by an application. + * + * \param app_name The name of the binary. + * \param icon The name of the icon to be shown in notification. + * \retval notificator A new notificator object to be freed with \c gaminggear_screen_notificator_deinit() + * or \c NULL on error. + * \since 1.0 + */ +GaminggearScreenNotificator *gaminggear_screen_notificator_init(gchar const *app_name, gchar const *icon); + +/*! \brief Frees an existing notificator. + * \param notificator The notificator to be freed. + * \since 1.0 + */ +void gaminggear_screen_notificator_deinit(GaminggearScreenNotificator *notificator); + +/*! \brief Create new notification. + * \param notificator A notificator. + * \retval notification A new notification to be freed with \c gaminggear_screen_notification_free(). + * \since 1.0 + */ +GaminggearScreenNotification *gaminggear_screen_notification_new(GaminggearScreenNotificator *notificator); + +/*! \brief Frees an existing notification. + * \param notification The notification to be freed. + * \since 1.0 + */ +void gaminggear_screen_notification_free(GaminggearScreenNotification *notification); + +/*! \brief Show notification. + * + * If this notification is already visible it's content is updated. + * + * \param notification The notification to be updated. + * \param format A \c printf() compatible format string. + * \param ... The arguments to be inserted in the output. + * \retval bool \c TRUE on success, else \c FALSE. + * \since 1.0 + */ +gboolean gaminggear_screen_notification_update(GaminggearScreenNotification *notification, gchar const *format, ...); + +/*! \brief Show notification. + * + * If this notification is already visible it's content is updated. + * + * \param notification The notification to be updated. + * \param format A \c printf() compatible format string. + * \param args The arguments to be inserted in the output. + * \retval bool \c TRUE on success, else \c FALSE. + * \since 1.0 + */ +gboolean gaminggear_screen_notification_update_v(GaminggearScreenNotification *notification, gchar const *format, va_list args); + +/*! \brief Cancel a running notification. + * \param notification Notification to be cancelled. + * \retval bool \c TRUE on success, else \c FALSE. + * \since 1.0 + */ +gboolean gaminggear_screen_notification_cancel(GaminggearScreenNotification *notification); + +G_END_DECLS + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/libgaminggear/CMakeLists.txt new/libgaminggear-0.4.0/libgaminggear/CMakeLists.txt --- old/libgaminggear-0.3.0/libgaminggear/CMakeLists.txt 2014-06-05 15:41:06.000000000 +0200 +++ new/libgaminggear-0.4.0/libgaminggear/CMakeLists.txt 2014-07-04 14:37:43.000000000 +0200 @@ -9,6 +9,7 @@ ) SET(SOURCES + gaminggear_audio_notificator_canberra.c gaminggear_configuration.c gaminggear_device.c gaminggear_evdev.c @@ -20,6 +21,7 @@ gaminggear_macro_threads.c gaminggear_macro.c gaminggear_macros.c + gaminggear_screen_notificator_notify.c macros_converter_roccat_arvo.c macros_converter_roccat_kone.c macros_converter_roccat_valo.c @@ -28,7 +30,9 @@ ) SET(LIBRARIES + ${CANBERRA_LIBRARIES} ${GLIB2_LIBRARIES} + ${NOTIFY_LIBRARIES} ) IF(SQLITE3_FOUND) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/libgaminggear/gaminggear_audio_notificator_canberra.c new/libgaminggear-0.4.0/libgaminggear/gaminggear_audio_notificator_canberra.c --- old/libgaminggear-0.3.0/libgaminggear/gaminggear_audio_notificator_canberra.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/libgaminggear/gaminggear_audio_notificator_canberra.c 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,137 @@ +/* + * This file is part of libgaminggear. + * + * libgaminggear is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * libgaminggear is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libgaminggear. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "gaminggear/audio_notificator.h" +#include <canberra.h> +#include <unistd.h> + +struct _GaminggearAudioNotificator { + ca_context *context; + guint next_id; +}; + +struct _GaminggearAudioNotification { + GaminggearAudioNotificator *notificator; + guint id; +}; + +static guint gaminggear_audio_notificator_claim_next_id(GaminggearAudioNotificator *notificator) { + return notificator->next_id++; +} + +GaminggearAudioNotificator *gaminggear_audio_notificator_init(gchar const *app_name, gchar const *version_string, gchar const *sound_driver) { + GaminggearAudioNotificator *notificator; + gint retval; + gchar *pid_string; + + notificator = (GaminggearAudioNotificator *)g_malloc0(sizeof(GaminggearAudioNotificator)); + + /* Creating own context to be independent of sound scheme. */ + retval = ca_context_create(¬ificator->context); + if (retval) { + g_warning("Error initializing canberra: %s", ca_strerror(retval)); + goto out; + } + + /* Setting driver explicit to be independent of warning sound volume */ + retval = ca_context_set_driver(notificator->context, sound_driver); + if (retval) { + g_warning("Error setting canberra driver: %s", ca_strerror(retval)); + goto destroy_context; + } + + pid_string = g_strdup_printf("%lu", (gulong)getpid()); + retval = ca_context_change_props(notificator->context, + CA_PROP_APPLICATION_NAME, app_name, + CA_PROP_APPLICATION_VERSION, version_string, + CA_PROP_APPLICATION_PROCESS_ID, pid_string, + NULL); + g_free(pid_string); + if (retval) { + g_warning("Error setting canberra properties: %s", ca_strerror(retval)); + goto destroy_context; + } + + retval = ca_context_open(notificator->context); + if (retval) { + g_warning("Error connecting canberra context: %s", ca_strerror(retval)); + goto destroy_context; + } + + notificator->next_id = 1; + + return notificator; + +destroy_context: + ca_context_destroy(notificator->context); +out: + g_free(notificator); + return NULL; +} + +void gaminggear_audio_notificator_deinit(GaminggearAudioNotificator *notificator) { + gint retval; + + if (notificator->context == NULL) + return; + + retval = ca_context_destroy(notificator->context); + if (retval) + g_warning("Error deinitializing canberra: %s", ca_strerror(retval)); + g_free(notificator); +} + +GaminggearAudioNotification *gaminggear_audio_notification_new(GaminggearAudioNotificator *notificator) { + GaminggearAudioNotification *notification; + notification = (GaminggearAudioNotification *)g_malloc0(sizeof(GaminggearAudioNotification)); + notification->notificator = notificator; + notification->id = gaminggear_audio_notificator_claim_next_id(notificator); + return notification; +} + +void gaminggear_audio_notification_free(GaminggearAudioNotification *notification) { + g_free(notification); +} + +gboolean gaminggear_audio_notification_cancel(GaminggearAudioNotification *notification) { + gint retval; + retval = ca_context_cancel(notification->notificator->context, notification->id); + if (retval != 0 && retval != CA_ERROR_STATE) { + g_warning("Error cancelling audio notificator: %s", ca_strerror(retval)); + return FALSE; + } + return TRUE; +} + +gboolean gaminggear_audio_notification_update(GaminggearAudioNotification *notification, gchar const *filename, gdouble volume) { + gint retval; + gchar *volume_string; + + volume_string = g_strdup_printf("%f", volume); + + gaminggear_audio_notification_cancel(notification); + retval = ca_context_play(notification->notificator->context, notification->id, + CA_PROP_CANBERRA_VOLUME, volume_string, + CA_PROP_MEDIA_FILENAME, filename, + NULL); + g_free(volume_string); + if (retval) { + g_warning("Error updating audio notificator: %s", ca_strerror(retval)); + return FALSE; + } + return TRUE; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/libgaminggear/gaminggear_device.c new/libgaminggear-0.4.0/libgaminggear/gaminggear_device.c --- old/libgaminggear-0.3.0/libgaminggear/gaminggear_device.c 2014-06-05 15:41:06.000000000 +0200 +++ new/libgaminggear-0.4.0/libgaminggear/gaminggear_device.c 2014-07-04 14:37:43.000000000 +0200 @@ -27,6 +27,7 @@ struct _GaminggearDevicePrivate { gchar *identifier; // unique per device, not interface + guint vendor_id; guint product_id; GaminggearRecMutex lock; }; @@ -35,6 +36,7 @@ PROP_0, PROP_IDENTIFIER, PROP_PRODUCT_ID, + PROP_VENDOR_ID, }; G_DEFINE_TYPE(GaminggearDevice, gaminggear_device, G_TYPE_OBJECT); @@ -139,9 +141,19 @@ return gaminggear_dev->priv->product_id; } -GaminggearDevice *gaminggear_device_new(gchar const *identifier, guint product_id) { +guint gaminggear_device_get_vendor_id(GaminggearDevice const *gaminggear_dev) { + return gaminggear_dev->priv->vendor_id; +} + +gboolean gaminggear_device_matches(GaminggearDevice const *gaminggear_dev, guint vendor_id, guint product_id) { + GaminggearDevicePrivate *priv = gaminggear_dev->priv; + return (priv->vendor_id == vendor_id && priv->product_id == product_id); +} + +GaminggearDevice *gaminggear_device_new(gchar const *identifier, guint vendor_id, guint product_id) { return GAMINGGEAR_DEVICE(g_object_new(GAMINGGEAR_DEVICE_TYPE, "identifier", identifier, + "vendor-id", vendor_id, "product-id", product_id, NULL)); } @@ -163,6 +175,9 @@ case PROP_PRODUCT_ID: priv->product_id = g_value_get_uint(value); break; + case PROP_VENDOR_ID: + priv->vendor_id = g_value_get_uint(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -201,6 +216,13 @@ "Product ID", 0, G_MAXUINT, 0, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property(gobject_class, PROP_VENDOR_ID, + g_param_spec_uint("vendor-id", + "vendor-id", + "Vendor ID", + 0, G_MAXUINT, 0, + G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); } gboolean gaminggear_device_equal(GaminggearDevice const *one, GaminggearDevice const *other) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/libgaminggear/gaminggear_screen_notificator_notify.c new/libgaminggear-0.4.0/libgaminggear/gaminggear_screen_notificator_notify.c --- old/libgaminggear-0.3.0/libgaminggear/gaminggear_screen_notificator_notify.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/libgaminggear/gaminggear_screen_notificator_notify.c 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,113 @@ +/* + * This file is part of libgaminggear. + * + * libgaminggear is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * libgaminggear is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libgaminggear. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "gaminggear/screen_notificator.h" +#include "config.h" +#include <libnotify/notify.h> + +struct _GaminggearScreenNotificator { + gchar *icon; +}; + +struct _GaminggearScreenNotification { + NotifyNotification *notification; + GaminggearScreenNotificator *notificator; +}; + +GaminggearScreenNotificator *gaminggear_screen_notificator_init(gchar const *app_name, gchar const *icon) { + GaminggearScreenNotificator *notificator; + + if (!notify_init(app_name)) { + g_warning("Error initializing notify"); + return NULL; + } + + notificator = (GaminggearScreenNotificator *)g_malloc0(sizeof(GaminggearScreenNotificator)); + notificator->icon = g_strdup(icon); + return notificator; +} + +void gaminggear_screen_notificator_deinit(GaminggearScreenNotificator *notificator) { + g_free(notificator->icon); + notify_uninit(); +} + +GaminggearScreenNotification *gaminggear_screen_notification_new(GaminggearScreenNotificator *notificator) { + GaminggearScreenNotification *notification; + notification = (GaminggearScreenNotification *)g_malloc0(sizeof(GaminggearScreenNotification)); +#ifdef HAVE_NOTIFY_0_7 + notification->notification = notify_notification_new("dummy", NULL, NULL); +#else + notification->notification = notify_notification_new("dummy", NULL, NULL, NULL); +#endif + notify_notification_set_timeout(notification->notification, NOTIFY_EXPIRES_DEFAULT); + notification->notificator = notificator; + return notification; +} + +void gaminggear_screen_notification_free(GaminggearScreenNotification *notification) { + if (notification->notification) + g_object_unref(G_OBJECT(notification->notification)); + g_free(notification); +} + +gboolean gaminggear_screen_notification_cancel(GaminggearScreenNotification *notification) { + GError *local_error = NULL; + gboolean result; + + if (!notification->notification) + return FALSE; + + result = notify_notification_close(notification->notification, &local_error); + g_clear_error(&local_error); + return result; +} + +gboolean gaminggear_screen_notification_update_v(GaminggearScreenNotification *notification, gchar const *format, va_list args) { + gchar *summary; + gboolean result; + GError *local_error = NULL; + + if (!notification->notification) + return TRUE; + + summary = g_strdup_vprintf(format, args); + + result = notify_notification_update(notification->notification, summary, NULL, notification->notificator->icon); + if (!result) + goto free_summary; + result = notify_notification_show(notification->notification, &local_error); + g_clear_error(&local_error); + +free_summary: + g_free(summary); + return result; +} + +gboolean gaminggear_screen_notification_update(GaminggearScreenNotification *notification, gchar const *format, ...) { + va_list args; + gboolean retval; + + if (!notification->notification) + return TRUE; + + va_start(args, format); + retval = gaminggear_screen_notification_update_v(notification, format, args); + va_end(args); + + return retval; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/libgaminggear.spec new/libgaminggear-0.4.0/libgaminggear.spec --- old/libgaminggear-0.3.0/libgaminggear.spec 2014-06-05 15:41:06.000000000 +0200 +++ new/libgaminggear-0.4.0/libgaminggear.spec 2014-07-04 14:37:43.000000000 +0200 @@ -1,5 +1,5 @@ %define vmajor 0 -%define vminor 3 +%define vminor 4 %define vmicro 0 Name: libgaminggear @@ -11,6 +11,8 @@ BuildRequires: cmake >= 2.6.4 BuildRequires: gtk2-devel >= 2.20 BuildRequires: sqlite >= 3.7 +BuildRequires: libcanberra-devel +BuildRequires: libnotify-devel ExclusiveOS: linux Prefix: /usr URL: http://sourceforge.net/projects/libgaminggear/ @@ -78,5 +80,5 @@ /usr/share/cmake/Modules/FindGAMINGGEAR%{vmajor}.cmake %changelog -* Thu Jun 05 2014 Stefan Achatz <erazor_de@users.sourceforge.net> 0.3.0-1 +* Fri Jul 04 2014 Stefan Achatz <erazor_de@users.sourceforge.net> 0.4.0-1 - Initial version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/scripts/install_deps_fedora new/libgaminggear-0.4.0/scripts/install_deps_fedora --- old/libgaminggear-0.3.0/scripts/install_deps_fedora 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/scripts/install_deps_fedora 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,2 @@ +#!/bin/sh +yum install gcc cmake libcanberra-devel gtk2-devel libgudev1-devel libnotify-devel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/scripts/install_deps_opensuse new/libgaminggear-0.4.0/scripts/install_deps_opensuse --- old/libgaminggear-0.3.0/scripts/install_deps_opensuse 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/scripts/install_deps_opensuse 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,2 @@ +#!/bin/sh +yast -i gcc cmake libcanberra-devel gtk2-devel libgudev-1_0-devel libnotify-devel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libgaminggear-0.3.0/scripts/install_deps_ubuntu new/libgaminggear-0.4.0/scripts/install_deps_ubuntu --- old/libgaminggear-0.3.0/scripts/install_deps_ubuntu 1970-01-01 01:00:00.000000000 +0100 +++ new/libgaminggear-0.4.0/scripts/install_deps_ubuntu 2014-07-04 14:37:43.000000000 +0200 @@ -0,0 +1,2 @@ +#!/bin/sh +sudo apt-get install gcc cmake libcanberra-dev libgtk2.0-dev libgudev-1.0-dev libnotify-dev -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org