diff -Nru cdemu-daemon-3.0.5/cmake/FindIntlTool.cmake cdemu-daemon-3.1.0/cmake/FindIntlTool.cmake --- cdemu-daemon-3.0.5/cmake/FindIntlTool.cmake 1970-01-01 00:00:00.000000000 +0000 +++ cdemu-daemon-3.1.0/cmake/FindIntlTool.cmake 2017-06-10 21:29:17.000000000 +0000 @@ -0,0 +1,93 @@ +# +# Cmake include for IntlTool +# +# Author: Henrik Stokseth +# + +include (FindPackageHandleStandardArgs) + +find_program (INTLTOOL_UPDATE_EXECUTABLE NAMES intltool-update) +find_program (INTLTOOL_EXTRACT_EXECUTABLE NAMES intltool-extract) +find_program (INTLTOOL_MERGE_EXECUTABLE NAMES intltool-merge) +find_program (INTLTOOL_PREPARE_EXECUTABLE NAMES intltool-prepare) + +mark_as_advanced ( + INTLTOOL_UPDATE_EXECUTABLE + INTLTOOL_EXTRACT_EXECUTABLE + INTLTOOL_MERGE_EXECUTABLE + INTLTOOL_PREPARE_EXECUTABLE +) + +if (INTLTOOL_UPDATE_EXECUTABLE) + execute_process ( + COMMAND ${INTLTOOL_UPDATE_EXECUTABLE} --version + COMMAND head -n 1 + COMMAND cut -d " " -f 3 + OUTPUT_VARIABLE INTLTOOL_VERSION + ) +endif () + +find_package_handle_standard_args (IntlTool + REQUIRED_VARS INTLTOOL_UPDATE_EXECUTABLE INTLTOOL_EXTRACT_EXECUTABLE + INTLTOOL_MERGE_EXECUTABLE INTLTOOL_PREPARE_EXECUTABLE + VERSION_VAR INTLTOOL_VERSION +) + +function (intltool_process_po_files po_dir catalog_name) + set (gmo_files) + + # If list of languages was explicitly given, use it; otherwise, use + # all files in the PO dir + if (${ARGC} GREATER 2) + set (po_files) + foreach (whitelisted_language ${ARGN}) + set (po_files ${po_files} ${po_dir}/${whitelisted_language}.po) + endforeach () + else () + file (GLOB po_files ${po_dir}/*.po) + endif () + + foreach (po_file ${po_files}) + get_filename_component (lang ${po_file} NAME_WE) + set (gmo_file ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo) + add_custom_command ( + OUTPUT ${gmo_file} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${gmo_file} ${po_file} + DEPENDS ${po_file} + ) + install ( + FILES ${gmo_file} + DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES + RENAME ${catalog_name}.mo + ) + set (gmo_files ${gmo_files} ${gmo_file}) + endforeach () + + set (translations-target "${PROJECT_NAME}-translations") + add_custom_target (${translations-target} ALL DEPENDS ${gmo_files}) +endfunction () + +function (intltool_merge options po_dir in_filename out_filename) + string(FIND ${options} "--no-translations" no_translations) + string(REPLACE " " ";" options ${options}) + if (${no_translations} EQUAL -1) + add_custom_command ( + OUTPUT ${out_filename} + COMMAND ${INTLTOOL_MERGE_EXECUTABLE} ${options} -q -u ${po_dir} + ${in_filename} ${out_filename} + DEPENDS ${in_filename} + ) + else () + # The --no-translations version should not be given the po dir + add_custom_command ( + OUTPUT ${out_filename} + COMMAND ${INTLTOOL_MERGE_EXECUTABLE} ${options} -q -u + ${in_filename} ${out_filename} + DEPENDS ${in_filename} + ) + endif () + + get_filename_component (out_name ${out_filename} NAME) + add_custom_target (intltool-merge-${out_name} ALL DEPENDS ${out_filename}) +endfunction () + diff -Nru cdemu-daemon-3.0.5/CMakeLists.txt cdemu-daemon-3.1.0/CMakeLists.txt --- cdemu-daemon-3.0.5/CMakeLists.txt 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/CMakeLists.txt 2017-06-10 21:29:17.000000000 +0000 @@ -3,8 +3,11 @@ # Project name project (cdemu-daemon C) +# Additional CMake modules. +list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + # Versioning -set (CDEMU_DAEMON_VERSION 3.0.5) +set (CDEMU_DAEMON_VERSION 3.1.0) set (CDEMU_DAEMON_INTERFACE_VERSION_MAJOR 7) set (CDEMU_DAEMON_INTERFACE_VERSION_MINOR 0) @@ -22,8 +25,10 @@ # Dependencies find_package (PkgConfig 0.16 REQUIRED) +find_package (IntlTool 0.21 REQUIRED) +find_package (Gettext 0.15 REQUIRED) -pkg_check_modules (LIBMIRAGE REQUIRED libmirage>=${CDEMU_DAEMON_VERSION}) +pkg_check_modules (LIBMIRAGE REQUIRED libmirage>=3.1.0) pkg_check_modules (GLIB REQUIRED glib-2.0>=2.24 gobject-2.0>=2.24 gmodule-2.0>=2.24 gthread-2.0>=2.24 gio-2.0>=2.26) pkg_check_modules (AO REQUIRED ao>=0.8.0) @@ -50,6 +55,10 @@ add_definitions (-Wall -Wextra -Wshadow -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align) endif () +# Definitions needed for localization +add_definitions (-DGETTEXT_PACKAGE="cdemu-daemon") +add_definitions (-DLOCALEDIR="${CMAKE_INSTALL_FULL_DATADIR}/locale") + # Include directories include_directories (${PROJECT_BINARY_DIR}) @@ -121,6 +130,12 @@ ) endif () +# Translations; we use the version provided by our FindIntlTool.cmake +# instead of the gettext version... Note: first two arguments are mandatory, +# the rest is an optional list of languages to process. If no languages +# are given, all POs are processed. +intltool_process_po_files(${PROJECT_SOURCE_DIR}/po ${PROJECT_NAME}) + # *** Configuration summary *** message(STATUS "") message(STATUS "*** CDEmu daemon v.${CDEMU_DAEMON_VERSION} configuration summary ***") diff -Nru cdemu-daemon-3.0.5/debian/changelog cdemu-daemon-3.1.0/debian/changelog --- cdemu-daemon-3.0.5/debian/changelog 2016-10-09 11:00:00.000000000 +0000 +++ cdemu-daemon-3.1.0/debian/changelog 2017-06-10 11:00:00.000000000 +0000 @@ -1,3 +1,7 @@ +cdemu-daemon (3.1.0-1ubuntu1~yakkety~ppa1) yakkety; urgency=low + * Updated to 3.1.0. + -- Rok Mandeljc Sat, 10 Jun 2017 12:00:00 +0100 + cdemu-daemon (3.0.5-1ubuntu1~yakkety~ppa2) yakkety; urgency=low * Initial release for 16.10 Yakkety. -- Rok Mandeljc Sun, 09 Oct 2016 12:00:00 +0100 diff -Nru cdemu-daemon-3.0.5/debian/control cdemu-daemon-3.1.0/debian/control --- cdemu-daemon-3.0.5/debian/control 2016-10-09 11:00:00.000000000 +0000 +++ cdemu-daemon-3.1.0/debian/control 2017-06-10 11:00:00.000000000 +0000 @@ -3,8 +3,9 @@ Priority: optional Homepage: http://cdemu.sourceforge.net/ Maintainer: Henrik Stokseth -Build-Depends: libglib2.0-dev (>= 2.28), libao-dev (>= 0.8.0), - libmirage10-dev (>= 3.0.0), debhelper (>= 9), cmake (>= 2.8.5) +Build-Depends: libglib2.0-dev (>= 2.28), libao-dev (>= 0.8.0), + libmirage11-dev (>= 3.1.0), debhelper (>= 9), intltool, + cmake (>= 2.8.5) Standards-Version: 3.9.7 diff -Nru cdemu-daemon-3.0.5/po/POTFILES.in cdemu-daemon-3.1.0/po/POTFILES.in --- cdemu-daemon-3.0.5/po/POTFILES.in 1970-01-01 00:00:00.000000000 +0000 +++ cdemu-daemon-3.1.0/po/POTFILES.in 2017-06-10 21:29:17.000000000 +0000 @@ -0,0 +1,8 @@ +# List of source files containing translatable strings. +# Please keep this file sorted alphabetically. +src/device.c +src/device-load.c +src/daemon.c +src/daemon-dbus.c +src/main.c + diff -Nru cdemu-daemon-3.0.5/po/ru.po cdemu-daemon-3.1.0/po/ru.po --- cdemu-daemon-3.0.5/po/ru.po 1970-01-01 00:00:00.000000000 +0000 +++ cdemu-daemon-3.1.0/po/ru.po 2017-06-10 21:29:17.000000000 +0000 @@ -0,0 +1,198 @@ +# Russian translation of cdemu-daemon. +# Copyright (C) 2006-2015 +# This file is distributed under the same license as the gCDEmu package. +# Grigorii Chirkov , 2006-2015. +# +msgid "" +msgstr "" +"Project-Id-Version: cdemu-daemon 3.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-10-15 23:17+0200\n" +"PO-Revision-Date: 2016-10-15 23:04+0200\n" +"Last-Translator: Grigorii Chirkov \n" +"Language-Team: Russian <>\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Gtranslator 2.91.7\n" + +#: ../src/device.c:206 ../src/device.c:290 +#, c-format +msgid "Invalid option name '%s'!" +msgstr "Некорректное название настройки '%s'!" + +#: ../src/device.c:226 ../src/device.c:234 ../src/device.c:242 +#: ../src/device.c:250 ../src/device.c:266 ../src/device.c:280 +#, c-format +msgid "Invalid argument type for option '%s'!" +msgstr "Некорректный тип аргумента для настройки '%s'!" + +#: ../src/device-load.c:36 ../src/device-load.c:114 +#, c-format +msgid "Device is already loaded!" +msgstr "Образ уже смонтирован в накопитель!" + +#: ../src/device-load.c:152 +#, c-format +msgid "Invalid medium type '%s'!" +msgstr "Некорректный тип данных '%s'!" + +#: ../src/device-load.c:163 +#, c-format +msgid "no image writer ID provided in parameters!" +msgstr "В параметрах не указан ID записывающего накопителя!" + +#: ../src/device-load.c:255 +#, c-format +msgid "Device is locked!" +msgstr "Накопитель заблокирован!" + +#: ../src/daemon.c:218 +#, c-format +msgid "Invalid device number!" +msgstr "Некорректный номер накопителя!" + +#: ../src/daemon-dbus.c:340 +#, c-format +msgid "Failed to add device!" +msgstr "Не удалось добавить накопитель!" + +#: ../src/daemon-dbus.c:346 +#, c-format +msgid "Failed to remove device!" +msgstr "Не удалось удалить накопитель!" + +#: ../src/daemon-dbus.c:361 +#, c-format +msgid "Invalid method name '%s'!" +msgstr "Некорретное название метода '%s'!" + +#: ../src/main.c:32 +msgid "Number of devices" +msgstr "Количество накопителей" + +#: ../src/main.c:32 +msgid "N" +msgstr "N" + +#: ../src/main.c:33 +msgid "Control device" +msgstr "Накопитель управления" + +#: ../src/main.c:33 +msgid "path" +msgstr "путь" + +#: ../src/main.c:34 +msgid "Audio driver" +msgstr "Аудиодрайвер" + +#: ../src/main.c:34 +msgid "driver" +msgstr "драйвер" + +#: ../src/main.c:35 +msgid "Bus type to use" +msgstr "Тип шины для использования" + +#: ../src/main.c:35 +msgid "bus_type" +msgstr "тип_шины" + +#: ../src/main.c:36 +msgid "Logfile" +msgstr "Файл журнала" + +#: ../src/main.c:36 +msgid "logfile" +msgstr "файл_журнала" + +#: ../src/main.c:57 +#, c-format +msgid "Received signal - %s\n" +msgstr "Получен сигнал - %s\n" + +#: ../src/main.c:81 +msgid "Failed to set sigaction for SIGTERM!" +msgstr "Не удалось установить sigaction на SIGTERM!" + +#: ../src/main.c:84 +msgid "Failed to set sigaction for SIGINT!" +msgstr "Не удалось установить sigaction на SIGINT!" + +#: ../src/main.c:87 +msgid "Failed to set sigaction for SIGQUIT!" +msgstr "Не удалось установить sigaction на SIGQUIT!" + +#: ../src/main.c:90 +msgid "Failed to set sigaction for SIGHUP!" +msgstr "Не удалось установить sigaction на SIGHUP!" + +#: ../src/main.c:130 +#, c-format +msgid "Failed to parse options: %s\n" +msgstr "Не удалось считать настройки: %s\n" + +#: ../src/main.c:139 +#, c-format +msgid "Failed to open log file %s for writing!\n" +msgstr "Не удалось открыть файл журнала %s для записи!\n" + +#: ../src/main.c:147 +#, c-format +msgid "Failed to initialize libMirage: %s!\n" +msgstr "Не удалось инициализировать библиотеку libMirage: %s!\n" + +#. Display status +#: ../src/main.c:153 +msgid "Starting CDEmu daemon with following parameters:\n" +msgstr "Запуск демона CDEmu со следующими параметрами:\n" + +#: ../src/main.c:154 +#, c-format +msgid " - num devices: %i\n" +msgstr " - количество накопителей: %i\n" + +#: ../src/main.c:155 +#, c-format +msgid " - control device: %s\n" +msgstr " - управление накопителем: %s\n" + +#: ../src/main.c:156 +#, c-format +msgid " - audio driver: %s\n" +msgstr " - аудиодрайвер: %s\n" + +#: ../src/main.c:157 +#, c-format +msgid " - bus type: %s\n" +msgstr " - тип шины: %s\n" + +#: ../src/main.c:167 +#, c-format +msgid "Invalid bus argument '%s', using default bus!\n" +msgstr "Некорректный тип шины '%s', используется шина по умолчанию!\n" + +#: ../src/main.c:173 +msgid "" +"WARNING: using CDEmu on system bus is deprecated and might lead to security " +"issues on multi-user systems! Consult the README file for more details.\n" +"\n" +msgstr "" +"ВНИМАНИЕ: использование CDEmu на системной шине обьявлено устаревшим и " +"может привести к проблемам безопасности на системах с несколькими " +"пользователями. Для более подробной информации обратитесь к файлу README.\n" +"\n" + +#. Printed when daemon stops +#: ../src/main.c:185 +msgid "Stopping daemon.\n" +msgstr "Остановка демона.\n" + +#: ../src/main.c:187 +msgid "Daemon initialization and start failed!\n" +msgstr "Не удалось инициализировать и запустить демон!\n" diff -Nru cdemu-daemon-3.0.5/po/sl.po cdemu-daemon-3.1.0/po/sl.po --- cdemu-daemon-3.0.5/po/sl.po 1970-01-01 00:00:00.000000000 +0000 +++ cdemu-daemon-3.1.0/po/sl.po 2017-06-10 21:29:17.000000000 +0000 @@ -0,0 +1,197 @@ +# Slovenian translation of cdemu-daemon. +# Copyright (C) 2016 Rok Mandeljc +# This file is distributed under the same license as the cdemu-daemon package. +# Rok Mandeljc , 2016. +# +msgid "" +msgstr "" +"Project-Id-Version: cdemu-daemon 3.0.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-10-15 23:17+0200\n" +"PO-Revision-Date: 2016-10-15 23:04+0200\n" +"Last-Translator: Rok Mandeljc \n" +"Language-Team: Slovenian <>\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Gtranslator 2.91.7\n" + +#: ../src/device.c:206 ../src/device.c:290 +#, c-format +msgid "Invalid option name '%s'!" +msgstr "Neveljavna nastavitev '%s'!" + +#: ../src/device.c:226 ../src/device.c:234 ../src/device.c:242 +#: ../src/device.c:250 ../src/device.c:266 ../src/device.c:280 +#, c-format +msgid "Invalid argument type for option '%s'!" +msgstr "Neveljavna vrsta argumenta za nastavitev '%s'!" + +#: ../src/device-load.c:36 ../src/device-load.c:114 +#, c-format +msgid "Device is already loaded!" +msgstr "Naprava je že naložena!" + +#: ../src/device-load.c:152 +#, c-format +msgid "Invalid medium type '%s'!" +msgstr "Neveljavna vrsta medija '%s'!" + +#: ../src/device-load.c:163 +#, c-format +msgid "no image writer ID provided in parameters!" +msgstr "V nastavitvah ni bil podan ID zapisovalca slik!" + +#: ../src/device-load.c:255 +#, c-format +msgid "Device is locked!" +msgstr "Naprava je zaklenjena!" + +#: ../src/daemon.c:218 +#, c-format +msgid "Invalid device number!" +msgstr "Neveljavna številka naprave!" + +#: ../src/daemon-dbus.c:340 +#, c-format +msgid "Failed to add device!" +msgstr "Napaka pri dodajanju naprave!" + +#: ../src/daemon-dbus.c:346 +#, c-format +msgid "Failed to remove device!" +msgstr "Napaka pri odstranjevanju naprave!" + +#: ../src/daemon-dbus.c:361 +#, c-format +msgid "Invalid method name '%s'!" +msgstr "Neveljavno ime metode '%s'!" + +#: ../src/main.c:32 +msgid "Number of devices" +msgstr "Število naprav" + +#: ../src/main.c:32 +msgid "N" +msgstr "N" + +#: ../src/main.c:33 +msgid "Control device" +msgstr "Kontrolna naprava" + +#: ../src/main.c:33 +msgid "path" +msgstr "pot-do-naprave" + +#: ../src/main.c:34 +msgid "Audio driver" +msgstr "Avdio gonilnik" + +#: ../src/main.c:34 +msgid "driver" +msgstr "gonilnik" + +#: ../src/main.c:35 +msgid "Bus type to use" +msgstr "Vrsta vodila" + +#: ../src/main.c:35 +msgid "bus_type" +msgstr "vrsta-vodila" + +#: ../src/main.c:36 +msgid "Logfile" +msgstr "Datoteka z dnevnikom" + +#: ../src/main.c:36 +msgid "logfile" +msgstr "ime-datoteke" + +#: ../src/main.c:57 +#, c-format +msgid "Received signal - %s\n" +msgstr "Prejel signal - %s\n" + +#: ../src/main.c:81 +msgid "Failed to set sigaction for SIGTERM!" +msgstr "Napaka pri nastavljanju sigaction za SIGTERM!" + +#: ../src/main.c:84 +msgid "Failed to set sigaction for SIGINT!" +msgstr "Napaka pri nastavljanju sigaction za SIGINT!" + +#: ../src/main.c:87 +msgid "Failed to set sigaction for SIGQUIT!" +msgstr "Napaka pri nastavljanju sigaction za SIGQUIT!" + +#: ../src/main.c:90 +msgid "Failed to set sigaction for SIGHUP!" +msgstr "Napaka pri nastavljanju sigaction za SIGHUP!" + +#: ../src/main.c:130 +#, c-format +msgid "Failed to parse options: %s\n" +msgstr "Napaka pri branju argumentorv: %s\n" + +#: ../src/main.c:139 +#, c-format +msgid "Failed to open log file %s for writing!\n" +msgstr "Napaka pri odpiranju datoteke z dnevnikom %s za pisanje!\n" + +#: ../src/main.c:147 +#, c-format +msgid "Failed to initialize libMirage: %s!\n" +msgstr "Napaka pri inicializaciji knjižnice libMirage: %s!\n" + +#. Display status +#: ../src/main.c:153 +msgid "Starting CDEmu daemon with following parameters:\n" +msgstr "Zaganjam CDEmu demon z naslednjimi nastavitvami:\n" + +#: ../src/main.c:154 +#, c-format +msgid " - num devices: %i\n" +msgstr " - število naprav: %i\n" + +#: ../src/main.c:155 +#, c-format +msgid " - control device: %s\n" +msgstr " - kontrolna naprava: %s\n" + +#: ../src/main.c:156 +#, c-format +msgid " - audio driver: %s\n" +msgstr " - avdio gonilnik: %s\n" + +#: ../src/main.c:157 +#, c-format +msgid " - bus type: %s\n" +msgstr " - vrsta vodila: %s\n" + +#: ../src/main.c:167 +#, c-format +msgid "Invalid bus argument '%s', using default bus!\n" +msgstr "Neveljavna vrsta vodila '%s', uporabljeno bo privzeto vodilo!\n" + +#: ../src/main.c:173 +msgid "" +"WARNING: using CDEmu on system bus is deprecated and might lead to security " +"issues on multi-user systems! Consult the README file for more details.\n" +"\n" +msgstr "" +"OPOZORILO: uporaba CDEmu na sistemskem vodilu je opuščena in lahko privede " +"do težav z varnostjo na več-uporabniških sistemih! Za več informacij " +"preberite README datoteko.\n" +"\n" + +#. Printed when daemon stops +#: ../src/main.c:185 +msgid "Stopping daemon.\n" +msgstr "Zaustavljam demon.\n" + +#: ../src/main.c:187 +msgid "Daemon initialization and start failed!\n" +msgstr "Napaka pri inicializaciji in zagonu demona!\n" diff -Nru cdemu-daemon-3.0.5/README cdemu-daemon-3.1.0/README --- cdemu-daemon-3.0.5/README 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/README 2017-06-10 21:29:17.000000000 +0000 @@ -1,5 +1,5 @@ CDEmu Daemon -3.0.5 +3.1.0 ~~~~~ diff -Nru cdemu-daemon-3.0.5/src/audio.c cdemu-daemon-3.1.0/src/audio.c --- cdemu-daemon-3.0.5/src/audio.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/audio.c 2017-06-10 21:29:17.000000000 +0000 @@ -146,16 +146,23 @@ static void cdemu_audio_start_playing (CdemuAudio *self) { + GError *local_error = NULL; + /* Set the status */ self->priv->status = AUDIO_STATUS_PLAYING; /* Start the playback thread; thread must be joinable, so we can wait for it to end */ #if !GLIB_CHECK_VERSION(2, 32, 0) - self->priv->playback_thread = g_thread_create((GThreadFunc)cdemu_audio_playback_thread, self, TRUE, NULL); + self->priv->playback_thread = g_thread_create((GThreadFunc)cdemu_audio_playback_thread, self, TRUE, &local_error); #else - self->priv->playback_thread = g_thread_new("CDEmu Device Audio Play thread", (GThreadFunc)cdemu_audio_playback_thread, self); + self->priv->playback_thread = g_thread_try_new("CDEmu Device Audio Play thread", (GThreadFunc)cdemu_audio_playback_thread, self, &local_error); #endif + + if (!self->priv->playback_thread) { + CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: failed to create audio playback thread: %s\n", __debug__, local_error->message); + g_error_free(local_error); + } } static void cdemu_audio_stop_playing (CdemuAudio *self, gint status) @@ -242,7 +249,7 @@ /* Resume is valid only if we're paused */ if (self->priv->status == AUDIO_STATUS_PAUSED) { - CDEMU_DEBUG(self, DAEMON_DEBUG_AUDIOPLAY, "%s: resuming playback (0x%X->0x%X)...\n", __debug__); + CDEMU_DEBUG(self, DAEMON_DEBUG_AUDIOPLAY, "%s: resuming playback (0x%X->0x%X)...\n", __debug__, self->priv->cur_sector, self->priv->end_sector); cdemu_audio_start_playing(self); } else { CDEMU_DEBUG(self, DAEMON_DEBUG_AUDIOPLAY, "%s: resume called when not paused!\n", __debug__); diff -Nru cdemu-daemon-3.0.5/src/cdemu.h cdemu-daemon-3.1.0/src/cdemu.h --- cdemu-daemon-3.0.5/src/cdemu.h 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/cdemu.h 2017-06-10 21:29:17.000000000 +0000 @@ -37,6 +37,9 @@ #include +#include +#include + #include #include diff -Nru cdemu-daemon-3.0.5/src/daemon.c cdemu-daemon-3.1.0/src/daemon.c --- cdemu-daemon-3.0.5/src/daemon.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/daemon.c 2017-06-10 21:29:17.000000000 +0000 @@ -215,7 +215,7 @@ { CdemuDevice *device = g_list_nth_data(self->priv->devices, device_number); if (!device) { - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid device number!"); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid device number!")); return NULL; } return g_object_ref(device); diff -Nru cdemu-daemon-3.0.5/src/daemon-dbus.c cdemu-daemon-3.1.0/src/daemon-dbus.c --- cdemu-daemon-3.0.5/src/daemon-dbus.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/daemon-dbus.c 2017-06-10 21:29:17.000000000 +0000 @@ -337,13 +337,13 @@ /* *** AddDevice *** */ succeeded = cdemu_daemon_add_device(self); if (!succeeded) { - g_set_error(&error, CDEMU_ERROR, CDEMU_ERROR_DAEMON_ERROR, "Failed to add device!"); + g_set_error(&error, CDEMU_ERROR, CDEMU_ERROR_DAEMON_ERROR, Q_("Failed to add device!")); } } else if (!g_strcmp0(method_name, "RemoveDevice")) { /* *** RemoveDevice *** */ succeeded = cdemu_daemon_remove_device(self); if (!succeeded) { - g_set_error(&error, CDEMU_ERROR, CDEMU_ERROR_DAEMON_ERROR, "Failed to remove device!"); + g_set_error(&error, CDEMU_ERROR, CDEMU_ERROR_DAEMON_ERROR, Q_("Failed to remove device!")); } } else if (!g_strcmp0(method_name, "EnumWriterParameters")) { /* *** EnumWriterParameters *** */ @@ -358,7 +358,7 @@ succeeded = TRUE; } } else { - g_set_error(&error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid method name '%s'!", method_name); + g_set_error(&error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid method name '%s'!"), method_name); } if (succeeded) { diff -Nru cdemu-daemon-3.0.5/src/device.c cdemu-daemon-3.1.0/src/device.c --- cdemu-daemon-3.0.5/src/device.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/device.c 2017-06-10 21:29:17.000000000 +0000 @@ -203,7 +203,7 @@ } else { /* Option not found */ CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: option '%s' not found; client bug?\n", __debug__, option_name); - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid option name '%s'!", option_name); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid option name '%s'!"), option_name); } /* Unlock */ @@ -223,7 +223,7 @@ if (!g_strcmp0(option_name, "dpm-emulation")) { /* *** dpm-emulation *** */ if (!g_variant_is_of_type(option_value, G_VARIANT_TYPE("b"))) { - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid argument type for option '%s'!", option_name); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid argument type for option '%s'!"), option_name); succeeded = FALSE; } else { g_variant_get(option_value, "b", &self->priv->dpm_emulation); @@ -231,7 +231,7 @@ } else if (!g_strcmp0(option_name, "tr-emulation")) { /* *** tr-emulation *** */ if (!g_variant_is_of_type(option_value, G_VARIANT_TYPE("b"))) { - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid argument type for option '%s'!", option_name); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid argument type for option '%s'!"), option_name); succeeded = FALSE; } else { g_variant_get(option_value, "b", &self->priv->tr_emulation); @@ -239,7 +239,7 @@ } else if (!g_strcmp0(option_name, "bad-sector-emulation")) { /* *** bad-sector-emulation *** */ if (!g_variant_is_of_type(option_value, G_VARIANT_TYPE("b"))) { - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid argument type for option '%s'!", option_name); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid argument type for option '%s'!"), option_name); succeeded = FALSE; } else { g_variant_get(option_value, "b", &self->priv->bad_sector_emulation); @@ -247,7 +247,7 @@ } else if (!g_strcmp0(option_name, "device-id")) { /* *** device-id *** */ if (!g_variant_is_of_type(option_value, G_VARIANT_TYPE("(ssss)"))) { - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid argument type for option '%s'!", option_name); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid argument type for option '%s'!"), option_name); succeeded = FALSE; } else { gchar *vendor_id, *product_id, *revision, *vendor_specific; @@ -263,7 +263,7 @@ } else if (!g_strcmp0(option_name, "daemon-debug-mask")) { /* *** daemon-debug-mask *** */ if (!g_variant_is_of_type(option_value, G_VARIANT_TYPE("i"))) { - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid argument type for option '%s'!", option_name); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid argument type for option '%s'!"), option_name); succeeded = FALSE; } else { MirageContext *context = mirage_contextual_get_context(MIRAGE_CONTEXTUAL(self)); @@ -277,7 +277,7 @@ } else if (!g_strcmp0(option_name, "library-debug-mask")) { /* *** library-debug-mask *** */ if (!g_variant_is_of_type(option_value, G_VARIANT_TYPE("i"))) { - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid argument type for option '%s'!", option_name); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid argument type for option '%s'!"), option_name); succeeded = FALSE; } else { gint mask; @@ -287,7 +287,7 @@ } else { /* Option not found */ CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: option '%s' not found; client bug?\n", __debug__, option_name); - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid option name '%s'!", option_name); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid option name '%s'!"), option_name); succeeded = FALSE; } diff -Nru cdemu-daemon-3.0.5/src/device-commands.c cdemu-daemon-3.1.0/src/device-commands.c --- cdemu-daemon-3.0.5/src/device-commands.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/device-commands.c 2017-06-10 21:29:17.000000000 +0000 @@ -1469,7 +1469,7 @@ /* Copy ISRC */ mirage_helper_subchannel_q_decode_isrc(&tmp_buf[1], (gchar *)ret_data->isrc); ret_data->tcval = 1; - CDEMU_DEBUG(self, DAEMON_DEBUG_MMC, "%s: found ISRC in subchannel of sector 0x%X: <%.12s>\n", __debug__, sector, ret_data->isrc); + CDEMU_DEBUG(self, DAEMON_DEBUG_MMC, "%s: found ISRC in subchannel of sector 0x%X: <%.12s>\n", __debug__, address, ret_data->isrc); break; } } diff -Nru cdemu-daemon-3.0.5/src/device-delay.c cdemu-daemon-3.1.0/src/device-delay.c --- cdemu-daemon-3.0.5/src/device-delay.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/device-delay.c 2017-06-10 21:29:17.000000000 +0000 @@ -149,7 +149,7 @@ delay_diff.tv_usec = delay_now.tv_usec - self->priv->delay_begin.tv_usec; CDEMU_DEBUG(self, DAEMON_DEBUG_DELAY, "%s: calculated delay: %i microseconds\n", __debug__, self->priv->delay_amount); - CDEMU_DEBUG(self, DAEMON_DEBUG_DELAY, "%s: processing time: %i seconds, %i microseconds\n", __debug__, delay_diff.tv_sec, delay_diff.tv_usec); + CDEMU_DEBUG(self, DAEMON_DEBUG_DELAY, "%s: processing time: %li seconds, %li microseconds\n", __debug__, delay_diff.tv_sec, delay_diff.tv_usec); /* Compensate for the processing time */ delay = self->priv->delay_amount - (delay_diff.tv_sec * G_USEC_PER_SEC + delay_diff.tv_usec); diff -Nru cdemu-daemon-3.0.5/src/device-kernel-io.c cdemu-daemon-3.1.0/src/device-kernel-io.c --- cdemu-daemon-3.0.5/src/device-kernel-io.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/device-kernel-io.c 2017-06-10 21:29:17.000000000 +0000 @@ -135,7 +135,7 @@ sense.cmd_info[2] = (command_info & 0x0000FF00) >> 8; sense.cmd_info[3] = (command_info & 0x000000FF) >> 0; - CDEMU_DEBUG(self, DAEMON_DEBUG_KERNEL_IO, "%s: writing sense (%d bytes) to OUT buffer\n", __debug__, sizeof(struct REQUEST_SENSE_SenseFixed)); + CDEMU_DEBUG(self, DAEMON_DEBUG_KERNEL_IO, "%s: writing sense (%" G_GSIZE_MODIFIER "d bytes) to OUT buffer\n", __debug__, sizeof(struct REQUEST_SENSE_SenseFixed)); /* Write sense directly into command's output buffer */ memcpy(self->priv->cmd->out, &sense, sizeof(struct REQUEST_SENSE_SenseFixed)); @@ -167,7 +167,7 @@ ret = read(fd, vreq, BUF_SIZE); if (ret < (gssize)sizeof(struct vhba_request)) { - CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: failed to read request from control device (%d bytes; at least %d required)!\n", __debug__, ret, sizeof(struct vhba_request)); + CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: failed to read request from control device (%" G_GSIZE_MODIFIER "d bytes; at least %" G_GSIZE_MODIFIER "d required)!\n", __debug__, ret, sizeof(struct vhba_request)); /* Signal the kernel I/O error, so daemon can restart the device */ g_signal_emit_by_name(self, "kernel-io-error", NULL); return TRUE; @@ -205,7 +205,7 @@ ret = write(fd, vres, BUF_SIZE); if (ret < (gssize)sizeof(struct vhba_response)) { - CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: failed to write response to control device (%d bytes; at least %d required)!\n", __debug__, ret, sizeof(struct vhba_response)); + CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: failed to write response to control device (%" G_GSIZE_MODIFIER "d bytes; at least %" G_GSIZE_MODIFIER "d required)!\n", __debug__, ret, sizeof(struct vhba_response)); /* Signal the kernel I/O error, so daemon can restart the device */ g_signal_emit_by_name(self, "kernel-io-error", NULL); return TRUE; @@ -254,7 +254,12 @@ g_source_attach(self->priv->io_watch, self->priv->main_context); /* Start I/O thread */ +#if !GLIB_CHECK_VERSION(2, 32, 0) + self->priv->io_thread = g_thread_create((GThreadFunc)cdemu_device_io_thread, self, TRUE, &local_error); +#else self->priv->io_thread = g_thread_try_new("I/O thread", (GThreadFunc)cdemu_device_io_thread, self, &local_error); +#endif + if (!self->priv->io_thread) { CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: failed to start I/O thread: %s\n", __debug__, local_error->message); g_error_free(local_error); @@ -288,10 +293,10 @@ /* Unref thread */ if (self->priv->io_thread) { - /* Wait for the thread to finish */ + /* Wait for the thread to finish (also releases the reference + to thread object) */ g_thread_join(self->priv->io_thread); - g_thread_unref(self->priv->io_thread); self->priv->io_thread = NULL; } diff -Nru cdemu-daemon-3.0.5/src/device-load.c cdemu-daemon-3.1.0/src/device-load.c --- cdemu-daemon-3.0.5/src/device-load.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/device-load.c 2017-06-10 21:29:17.000000000 +0000 @@ -33,7 +33,7 @@ /* Well, we won't do anything if we're already loaded */ if (self->priv->loaded) { CDEMU_DEBUG(self, DAEMON_DEBUG_MMC, "%s: device already loaded\n", __debug__); - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_ALREADY_LOADED, "Device is already loaded!"); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_ALREADY_LOADED, Q_("Device is already loaded!")); return FALSE; } @@ -111,7 +111,7 @@ /* Well, we won't do anything if we're already loaded */ if (self->priv->loaded) { CDEMU_DEBUG(self, DAEMON_DEBUG_MMC, "%s: device already loaded\n", __debug__); - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_ALREADY_LOADED, "Device is already loaded!"); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_ALREADY_LOADED, Q_("Device is already loaded!")); return FALSE; } @@ -149,7 +149,7 @@ medium_type = MIRAGE_MEDIUM_DVD; medium_capacity = 2295104; } else { - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, "Invalid medium type '%s'!", medium_string); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_INVALID_ARGUMENT, Q_("Invalid medium type '%s'!"), medium_string); return FALSE; } } else if (g_str_has_prefix(key, "writer.")) { @@ -160,7 +160,7 @@ /* Image writer ID must be provided in parameters */ if (!writer_id) { CDEMU_DEBUG(self, DAEMON_DEBUG_WARNING, "%s: no image writer ID provided in parameters!\n", __debug__); - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_DAEMON_ERROR, "no image writer ID provided in parameters!"); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_DAEMON_ERROR, Q_("no image writer ID provided in parameters!")); g_hash_table_unref(writer_parameters); return FALSE; } @@ -252,7 +252,7 @@ /* Check if the door is locked */ if (self->priv->locked) { CDEMU_DEBUG(self, DAEMON_DEBUG_MMC, "%s: device is locked\n", __debug__); - g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_DEVICE_LOCKED, "Device is locked!"); + g_set_error(error, CDEMU_ERROR, CDEMU_ERROR_DEVICE_LOCKED, Q_("Device is locked!")); return FALSE; } diff -Nru cdemu-daemon-3.0.5/src/device-mode-pages.c cdemu-daemon-3.1.0/src/device-mode-pages.c --- cdemu-daemon-3.0.5/src/device-mode-pages.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/device-mode-pages.c 2017-06-10 21:29:17.000000000 +0000 @@ -424,7 +424,7 @@ struct ModePageGeneral *page_new = (struct ModePageGeneral *)(new_data); /* Get page's entry */ - GList *raw_entry = g_list_find_custom(self->priv->mode_pages_list, GINT_TO_POINTER(page_new->code), (GCompareFunc)find_mode_page); + GList *raw_entry = g_list_find_custom(self->priv->mode_pages_list, GINT_TO_POINTER((gint)page_new->code), (GCompareFunc)find_mode_page); if (!raw_entry) { CDEMU_DEBUG(self, DAEMON_DEBUG_MMC, "%s: we don't have mode page 0x%X\n", __debug__, page_new->code); return FALSE; diff -Nru cdemu-daemon-3.0.5/src/device-recording.c cdemu-daemon-3.1.0/src/device-recording.c --- cdemu-daemon-3.0.5/src/device-recording.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/device-recording.c 2017-06-10 21:29:17.000000000 +0000 @@ -212,6 +212,12 @@ return TRUE; } +static gboolean cdemu_device_recording_reserve_track (CdemuDevice *self G_GNUC_UNUSED, guint length G_GNUC_UNUSED) +{ + /* The default implementation is a no-op */ + return TRUE; +} + /**********************************************************************\ * Track-at-once (TAO) recording * @@ -422,7 +428,7 @@ .close_track = cdemu_device_recording_close_track, /* Use generic function */ .close_session = cdemu_device_recording_close_session, /* Use generic function */ .write_sectors = cdemu_device_tao_recording_write_sectors, - .reserve_track = NULL, /* No support for RESERVE TRACK */ + .reserve_track = cdemu_device_recording_reserve_track, /* Use generic no-op function */ }; @@ -633,7 +639,7 @@ .close_track = cdemu_device_recording_close_track, /* Use generic function */ .close_session = cdemu_device_recording_close_session, /* Use generic function */ .write_sectors = cdemu_device_raw_recording_write_sectors, - .reserve_track = NULL, /* No support for RESERVE TRACK */ + .reserve_track = cdemu_device_recording_reserve_track, /* Use generic no-op function */ }; @@ -821,7 +827,7 @@ /* In RAW SAO mode, the host sends us lead-in */ if (address < -150 && self->priv->sao_leadin_format & 0xC0) { - CDEMU_DEBUG(self, DAEMON_DEBUG_RECORDING, "%s: lead-in sector for RAW SAO\n", __debug__, address); + CDEMU_DEBUG(self, DAEMON_DEBUG_RECORDING, "%s: lead-in sector for RAW SAO\n", __debug__); main_format_ptr = sao_main_formats_find(self->priv->sao_leadin_format); subchannel_format_ptr = sao_subchannel_formats_find(self->priv->sao_leadin_format); @@ -1153,7 +1159,7 @@ } else if (adr == 2 || adr == 3) { /* MCN or ISRC; this means next entry must be valid, and must have same adr! */ if (i + 1 >= num_entries) { - CDEMU_DEBUG(self, DAEMON_DEBUG_RECORDING, "%s: missing next CUE entry for MCN/ISRC; skipping!\n", __debug__, i); + CDEMU_DEBUG(self, DAEMON_DEBUG_RECORDING, "%s: missing next CUE entry for MCN/ISRC; skipping!\n", __debug__); continue; } @@ -1205,7 +1211,7 @@ .close_track = cdemu_device_recording_close_track, /* Use generic function */ .close_session = cdemu_device_recording_close_session, /* Use generic function */ .write_sectors = cdemu_device_sao_recording_write_sectors, - .reserve_track = NULL, /* No support for RESERVE TRACK */ + .reserve_track = cdemu_device_recording_reserve_track, /* Use generic no-op function */ }; diff -Nru cdemu-daemon-3.0.5/src/main.c cdemu-daemon-3.1.0/src/main.c --- cdemu-daemon-3.0.5/src/main.c 2016-10-09 19:06:41.000000000 +0000 +++ cdemu-daemon-3.1.0/src/main.c 2017-06-10 21:29:17.000000000 +0000 @@ -29,11 +29,11 @@ static gchar *log_filename = NULL; static GOptionEntry option_entries[] = { - { "num-devices", 'n', 0, G_OPTION_ARG_INT, &num_devices, "Number of devices", "N" }, - { "ctl-device", 'c', 0, G_OPTION_ARG_STRING, &ctl_device, "Control device", "path" }, - { "audio-driver", 'a', 0, G_OPTION_ARG_STRING, &audio_driver, "Audio driver", "driver" }, - { "bus", 'b', 0, G_OPTION_ARG_STRING, &bus, "Bus type to use", "bus_type" }, - { "logfile", 'l', 0, G_OPTION_ARG_STRING, &log_filename, "Logfile", "logfile" }, + { "num-devices", 'n', 0, G_OPTION_ARG_INT, &num_devices, N_("Number of devices"), N_("N") }, + { "ctl-device", 'c', 0, G_OPTION_ARG_STRING, &ctl_device, N_("Control device"), N_("path") }, + { "audio-driver", 'a', 0, G_OPTION_ARG_STRING, &audio_driver, N_("Audio driver"), N_("driver") }, + { "bus", 'b', 0, G_OPTION_ARG_STRING, &bus, N_("Bus type to use"), N_("bus_type") }, + { "logfile", 'l', 0, G_OPTION_ARG_STRING, &log_filename, N_("Logfile"), N_("logfile") }, { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; @@ -52,10 +52,10 @@ /* Signal handler */ -static void __unix_signal_handler (int signal) +static void __unix_signal_handler (int signal_number) { - g_message("Received signal - %s\n", g_strsignal(signal)); - switch (signal) { + g_message(Q_("Received signal - %s\n"), g_strsignal(signal_number)); + switch (signal_number) { case SIGINT: case SIGQUIT: case SIGTERM: @@ -78,16 +78,16 @@ action.sa_flags = 0; if (sigaction(SIGTERM, &action, 0) > 0) { - g_warning("Failed to setup unix signal sigaction for SIGTERM!"); + g_warning(Q_("Failed to set sigaction for SIGTERM!")); } if (sigaction(SIGINT, &action, 0) > 0) { - g_warning("Failed to setup unix signal sigaction for SIGINT!"); + g_warning(Q_("Failed to set sigaction for SIGINT!")); } if (sigaction(SIGQUIT, &action, 0) > 0) { - g_warning("Failed to setup unix signal sigaction for SIGQUIT!"); + g_warning(Q_("Failed to set sigaction for SIGQUIT!")); } if (sigaction(SIGHUP, &action, 0) > 0) { - g_warning("Failed to setup unix signal sigaction for SIGHUP!"); + g_warning(Q_("Failed to set sigaction for SIGHUP!")); } } @@ -97,6 +97,12 @@ \******************************************************************************/ int main (int argc, char **argv) { + /* Localization support */ + setlocale(LC_ALL, ""); + bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); + /* Glib type system and threading system initialization; needed only in older glib versions */ #if !GLIB_CHECK_VERSION(2, 36, 0) @@ -114,13 +120,14 @@ GOptionContext *option_context; gboolean succeeded; - option_context = g_option_context_new("- CDEmu Daemon"); - g_option_context_add_main_entries(option_context, option_entries, NULL); + option_context = g_option_context_new(NULL); + g_option_context_set_translation_domain(option_context, GETTEXT_PACKAGE); + g_option_context_add_main_entries(option_context, option_entries, GETTEXT_PACKAGE); succeeded = g_option_context_parse(option_context, &argc, &argv, &error); g_option_context_free(option_context); if (!succeeded) { - g_warning("Failed to parse options: %s\n", error->message); + g_warning(Q_("Failed to parse options: %s\n"), error->message); g_error_free(error); return -1; } @@ -129,7 +136,7 @@ if (log_filename) { logfile = fopen(log_filename, "w"); /* Overwrite log file */ if (!logfile) { - g_warning("Failed to open log file %s for writing!\n", log_filename); + g_warning(Q_("Failed to open log file %s for writing!\n"), log_filename); return -1; } g_log_set_default_handler(log_handler_logfile, NULL); @@ -137,16 +144,18 @@ /* Initialize libMirage */ if (!mirage_initialize(&error)) { - g_warning("Failed to initialize libMirage: %s!\n", error->message); + g_warning(Q_("Failed to initialize libMirage: %s!\n"), error->message); g_error_free(error); return -1; } - g_message("Starting CDEmu daemon with following parameters:\n"); - g_message(" - num devices: %i\n", num_devices); - g_message(" - ctl device: %s\n", ctl_device); - g_message(" - audio driver: %s\n", audio_driver); - g_message(" - bus type: %s\n\n", bus); + /* Display status */ + g_message(Q_("Starting CDEmu daemon with following parameters:\n")); + g_message(Q_(" - num devices: %i\n"), num_devices); + g_message(Q_(" - control device: %s\n"), ctl_device); + g_message(Q_(" - audio driver: %s\n"), audio_driver); + g_message(Q_(" - bus type: %s\n"), bus); + g_message("\n"); /* Decipher bus type */ gboolean use_system_bus = FALSE; @@ -155,13 +164,13 @@ } else if (!mirage_helper_strcasecmp(bus, "session")) { use_system_bus = FALSE; } else { - g_warning("Invalid bus argument '%s', using default bus!\n", bus); + g_warning(Q_("Invalid bus argument '%s', using default bus!\n"), bus); use_system_bus = FALSE; } /* Discourage the use of system bus */ if (use_system_bus) { - g_message("WARNING: using CDEmu on system bus is deprecated and might lead to security issues on multi-user systems! Consult the README file for more details.\n\n"); + g_message(Q_("WARNING: using CDEmu on system bus is deprecated and might lead to security issues on multi-user systems! Consult the README file for more details.\n\n")); } /* Create daemon */ @@ -173,9 +182,9 @@ /* Initialize and start daemon */ if (cdemu_daemon_initialize_and_start(daemon_obj, num_devices, ctl_device, audio_driver, use_system_bus)) { /* Printed when daemon stops */ - g_message("Stopping daemon.\n"); + g_message(Q_("Stopping daemon.\n")); } else { - g_warning("Daemon initialization and start failed!\n"); + g_warning(Q_("Daemon initialization and start failed!\n")); succeeded = FALSE; }