diff options
author | Antenore Gatta <antenore.gatta@kyndryl.com> | 2021-10-27 01:36:47 +0300 |
---|---|---|
committer | Antenore Gatta <antenore.gatta@kyndryl.com> | 2021-10-27 01:36:47 +0300 |
commit | 22afd07de7055b32742dff6c5a36ff45ad29adb2 (patch) | |
tree | 66b18dae8dbce10306ca4dd0054c45f9f950cf6d | |
parent | 31453942043b12c6bb13016f8571ef4c0b6a4880 (diff) |
Move last_success to state file
This is a huge refactoring of the Remmina File interface.
In particular this patch move the last_success to the Remmina state file.
See issue #2271 and #1991
-rw-r--r-- | CMakeLists.txt | 458 | ||||
-rw-r--r-- | plugins/rdp/rdp_plugin.c | 4 | ||||
-rw-r--r-- | src/rcw.c | 12 | ||||
-rw-r--r-- | src/remmina_file.c | 161 | ||||
-rw-r--r-- | src/remmina_file.h | 8 | ||||
-rw-r--r-- | src/remmina_log.h | 1 | ||||
-rw-r--r-- | src/remmina_main.c | 1 | ||||
-rw-r--r-- | src/remmina_protocol_widget.c | 8 | ||||
-rw-r--r-- | src/remmina_ssh_plugin.c | 2 |
9 files changed, 385 insertions, 270 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 68b5030c7..66e977a3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,8 +67,8 @@ function(check_umask umask_val status_var) set(${status_var} 0 PARENT_SCOPE) if(UMASK_HAVE_R AND "${umask_x}" STREQUAL "xxx") set(${status_var} 1 PARENT_SCOPE) - endif(UMASK_HAVE_R AND "${umask_x}" STREQUAL "xxx") -endfunction(check_umask) + endif() +endfunction() find_program(SLEEP_EXEC sleep) mark_as_advanced(SLEEP_EXEC) @@ -84,10 +84,10 @@ if(NOT UMASK_EXEC) if("${umask_out}" MATCHES "^u=.*g=.*o=.*") set(UMASK_EXEC sh) set(UMASK_EXEC_ARGS -c "umask -S") - endif("${umask_out}" MATCHES "^u=.*g=.*o=.*") -else(NOT UMASK_EXEC) + endif() +else() set(UMASK_EXEC_ARGS -S) -endif(NOT UMASK_EXEC) +endif() if(UMASK_EXEC) execute_process(COMMAND ${UMASK_EXEC} ${UMASK_EXEC_ARGS} OUTPUT_VARIABLE umask_curr) @@ -98,144 +98,144 @@ if(UMASK_EXEC) message(WARNING "umask is set to ${umask_curr} - this setting is not recommended if one of the goals of this build is to generate packages. Use 'umask 022' for improved package behavior.") if(SLEEP_EXEC) execute_process(COMMAND ${SLEEP_EXEC} 10) - endif(SLEEP_EXEC) - endif(NOT UMASK_OK) -endif(UMASK_EXEC) + endif() + endif() +endif() if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") + set(CMAKE_BUILD_TYPE "Release") endif() if(NOT BUILD_SHARED_LIBS) - set(BUILD_SHARED_LIBS ON) + set(BUILD_SHARED_LIBS ON) endif() if(CMAKE_COMPILER_IS_GNUCC) - if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES - "i686") - check_symbol_exists(__x86_64__ "" IS_X86_64) - if(IS_X86_64) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES + "i686") + check_symbol_exists(__x86_64__ "" IS_X86_64) + if(IS_X86_64) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") + endif() else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") + if(CMAKE_POSITION_INDEPENDENT_CODE) + if(${CMAKE_VERSION} VERSION_LESS 2.8.9) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + endif() + endif() endif() - else() - if(CMAKE_POSITION_INDEPENDENT_CODE) - if(${CMAKE_VERSION} VERSION_LESS 2.8.9) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - endif() - endif() - endif() - - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - if(WITH_SSE2) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2") - endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - add_definitions(-DDEBUG) - check_c_compiler_flag(-Wunused-result Wunused-result) - if(Wunused-result) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-result") - endif() - check_c_compiler_flag(-Wunused-but-set-variable Wunused-but-set-variable) - if(Wunused-but-set-variable) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable") - endif() - check_c_compiler_flag(-Wdeprecated-declarations Wdeprecated-declarations) - if(Wdeprecated-declarations) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeprecated-declarations") + if(WITH_SSE2) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2") endif() - check_c_compiler_flag(-Wimplicit-function-declaration - Wimplicit-function-declaration) - if(Wimplicit-function-declaration) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration") - endif() - if(NOT OPENBSD) - check_c_compiler_flag(-Wredundant-decls Wredundant-decls) - if(Wredundant-decls) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") - endif() + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DDEBUG) + check_c_compiler_flag(-Wunused-result Wunused-result) + if(Wunused-result) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-result") + endif() + check_c_compiler_flag(-Wunused-but-set-variable Wunused-but-set-variable) + if(Wunused-but-set-variable) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable") + endif() + check_c_compiler_flag(-Wdeprecated-declarations Wdeprecated-declarations) + if(Wdeprecated-declarations) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeprecated-declarations") + endif() + + check_c_compiler_flag(-Wimplicit-function-declaration + Wimplicit-function-declaration) + if(Wimplicit-function-declaration) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration") + endif() + if(NOT OPENBSD) + check_c_compiler_flag(-Wredundant-decls Wredundant-decls) + if(Wredundant-decls) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") + endif() + endif() endif() - endif() - if(CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions(-DNDEBUG) - check_c_compiler_flag(-Wno-unused-result Wno-unused-result) - if(Wno-unused-result) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result") - endif() - check_c_compiler_flag(-Wno-unused-but-set-variable - Wno-unused-but-set-variable) - if(Wno-unused-but-set-variable) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable") - endif() - check_c_compiler_flag(-Wno-deprecated-declarations - Wno-deprecated-declarations) - if(Wno-deprecated-declarations) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") - endif() - - check_c_compiler_flag(-Wimplicit-function-declaration - Wimplicit-function-declaration) - if(Wimplicit-function-declaration) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration") - endif() - if(NOT OPENBSD) - check_c_compiler_flag(-Wredundant-decls Wredundant-decls) - if(Wredundant-decls) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") - endif() + if(CMAKE_BUILD_TYPE STREQUAL "Release") + add_definitions(-DNDEBUG) + check_c_compiler_flag(-Wno-unused-result Wno-unused-result) + if(Wno-unused-result) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result") + endif() + check_c_compiler_flag(-Wno-unused-but-set-variable + Wno-unused-but-set-variable) + if(Wno-unused-but-set-variable) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable") + endif() + check_c_compiler_flag(-Wno-deprecated-declarations + Wno-deprecated-declarations) + if(Wno-deprecated-declarations) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") + endif() + + check_c_compiler_flag(-Wimplicit-function-declaration + Wimplicit-function-declaration) + if(Wimplicit-function-declaration) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration") + endif() + if(NOT OPENBSD) + check_c_compiler_flag(-Wredundant-decls Wredundant-decls) + if(Wredundant-decls) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") + endif() + endif() + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") endif() - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") - endif() endif() if((TARGET_ARCH MATCHES "x86|x64") AND (NOT DEFINED WITH_SSE2)) - option(WITH_SSE2 "Enable SSE2 optimization." ON) + option(WITH_SSE2 "Enable SSE2 optimization." ON) else() - option(WITH_SSE2 "Enable SSE2 optimization." OFF) + option(WITH_SSE2 "Enable SSE2 optimization." OFF) endif() if(TARGET_ARCH MATCHES "ARM") - if(NOT DEFINED WITH_NEON) - option(WITH_NEON "Enable NEON optimization." ON) - else() - option(WITH_NEON "Enable NEON optimization." OFF) - endif() + if(NOT DEFINED WITH_NEON) + option(WITH_NEON "Enable NEON optimization." ON) + else() + option(WITH_NEON "Enable NEON optimization." OFF) + endif() else() - if(NOT APPLE) - option(WITH_IPP "Use Intel Performance Primitives." OFF) - endif() + if(NOT APPLE) + option(WITH_IPP "Use Intel Performance Primitives." OFF) + endif() endif() if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang") - if(CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions(-DNDEBUG) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros -Wno-padded") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-c11-extensions -Wno-gnu") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-command-line-argument") - check_c_compiler_flag(-Wno-deprecated-declarations - Wno-deprecated-declarations) - if(Wno-deprecated-declarations) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") - endif() - else() - add_definitions(-DDEBUG) - # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") set(CMAKE_C_FLAGS - # "${CMAKE_C_FLAGS} -Wunused-macros -Wpadded") set(CMAKE_C_FLAGS - # "${CMAKE_C_FLAGS} -Wc11-extensions -Wgnu") set(CMAKE_C_FLAGS - # "${CMAKE_C_FLAGS} -Wunused-command-line-argument") - check_c_compiler_flag(-Wdeprecated-declarations Wdeprecated-declarations) - if(Wdeprecated-declarations) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeprecated-declarations") + if(CMAKE_BUILD_TYPE STREQUAL "Release") + add_definitions(-DNDEBUG) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros -Wno-padded") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-c11-extensions -Wno-gnu") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-command-line-argument") + check_c_compiler_flag(-Wno-deprecated-declarations + Wno-deprecated-declarations) + if(Wno-deprecated-declarations) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") + endif() + else() + add_definitions(-DDEBUG) + # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-parameter") set(CMAKE_C_FLAGS + # "${CMAKE_C_FLAGS} -Wunused-macros -Wpadded") set(CMAKE_C_FLAGS + # "${CMAKE_C_FLAGS} -Wc11-extensions -Wgnu") set(CMAKE_C_FLAGS + # "${CMAKE_C_FLAGS} -Wunused-command-line-argument") + check_c_compiler_flag(-Wdeprecated-declarations Wdeprecated-declarations) + if(Wdeprecated-declarations) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeprecated-declarations") + endif() endif() - endif() endif() # Figure out no-undefined flag @@ -266,11 +266,11 @@ include_directories(src/include) # FreeBSD if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic") - include_directories(/usr/local/include /usr/include) - link_directories(/usr/local/lib /usr/lib) - set(CMAKE_REQUIRED_INCLUDES /usr/local/include) - set(CMAKE_SHARED_LIBRARY_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX} /usr/local/lib) + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic") + include_directories(/usr/local/include /usr/include) + link_directories(/usr/local/lib /usr/lib) + set(CMAKE_REQUIRED_INCLUDES /usr/local/include) + set(CMAKE_SHARED_LIBRARY_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX} /usr/local/lib) endif() # Versioning @@ -282,14 +282,14 @@ set(REMMINA_VERSION_REVISION "21") # "${REMMINA_VERSION_MAJOR}.${REMMINA_VERSION_MINOR}.${REMMINA_VERSION_REVISION}.${REMMINA_VERSION_SUFFIX}") set(REMMINA_VERSION "${REMMINA_VERSION_MAJOR}.${REMMINA_VERSION_MINOR}.${REMMINA_VERSION_REVISION}" -) + ) message(STATUS "Remmina version: ${REMMINA_VERSION}") include(GetGitRevisionDescription) git_get_exact_tag(REMMINA_GIT_REVISION --tags --always) if(${REMMINA_GIT_REVISION} STREQUAL "n/a") - git_rev_parse(REMMINA_GIT_REVISION --short) + git_rev_parse(REMMINA_GIT_REVISION --short) endif() message(STATUS "Git Revision: ${REMMINA_GIT_REVISION}") @@ -298,62 +298,62 @@ message(STATUS "Git Revision: ${REMMINA_GIT_REVISION}") set(REMMINA_APP_ID "org.remmina.Remmina") if(NOT REMMINA_DATADIR) - set(REMMINA_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}") - if(NOT REMMINA_RUNTIME_DATADIR) - set(REMMINA_RUNTIME_DATADIR "${REMMINA_DATADIR}") - endif() + set(REMMINA_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}") + if(NOT REMMINA_RUNTIME_DATADIR) + set(REMMINA_RUNTIME_DATADIR "${REMMINA_DATADIR}") + endif() endif() if(NOT REMMINA_TERM_CS_DIR) - set(REMMINA_TERM_CS_DIR "${REMMINA_DATADIR}/remmina/theme") + set(REMMINA_TERM_CS_DIR "${REMMINA_DATADIR}/remmina/theme") endif() if(NOT REMMINA_LOCALEDIR) - set(REMMINA_LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}") - if(NOT REMMINA_RUNTIME_LOCALEDIR) - set(REMMINA_RUNTIME_LOCALEDIR "${REMMINA_LOCALEDIR}") - endif() + set(REMMINA_LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}") + if(NOT REMMINA_RUNTIME_LOCALEDIR) + set(REMMINA_RUNTIME_LOCALEDIR "${REMMINA_LOCALEDIR}") + endif() endif() if(NOT REMMINA_PLUGINDIR) - set(REMMINA_PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/remmina/plugins") - if(NOT REMMINA_RUNTIME_PLUGINDIR) - set(REMMINA_RUNTIME_PLUGINDIR "${REMMINA_PLUGINDIR}") - endif() + set(REMMINA_PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/remmina/plugins") + if(NOT REMMINA_RUNTIME_PLUGINDIR) + set(REMMINA_RUNTIME_PLUGINDIR "${REMMINA_PLUGINDIR}") + endif() endif() if(NOT REMMINA_UIDIR) - set(REMMINA_UIDIR "${REMMINA_DATADIR}/remmina/ui") - if(NOT REMMINA_RUNTIME_UIDIR) - set(REMMINA_RUNTIME_UIDIR "${REMMINA_UIDIR}") - endif() + set(REMMINA_UIDIR "${REMMINA_DATADIR}/remmina/ui") + if(NOT REMMINA_RUNTIME_UIDIR) + set(REMMINA_RUNTIME_UIDIR "${REMMINA_UIDIR}") + endif() endif() if(NOT REMMINA_THEMEDIR) - set(REMMINA_THEMEDIR "${REMMINA_DATADIR}/remmina/theme") - if(NOT REMMINA_RUNTIME_THEMEDIR) - set(REMMINA_RUNTIME_THEMEDIR "${REMMINA_THEMEDIR}") - endif() + set(REMMINA_THEMEDIR "${REMMINA_DATADIR}/remmina/theme") + if(NOT REMMINA_RUNTIME_THEMEDIR) + set(REMMINA_RUNTIME_THEMEDIR "${REMMINA_THEMEDIR}") + endif() endif() if(NOT REMMINA_RESDIR) - set(REMMINA_RESDIR "${REMMINA_DATADIR}/remmina/res") - if(NOT REMMINA_RUNTIME_RESDIR) - set(REMMINA_RUNTIME_RESDIR "${REMMINA_RESDIR}") - endif() + set(REMMINA_RESDIR "${REMMINA_DATADIR}/remmina/res") + if(NOT REMMINA_RUNTIME_RESDIR) + set(REMMINA_RUNTIME_RESDIR "${REMMINA_RESDIR}") + endif() endif() if(NOT REMMINA_EXTERNAL_TOOLS_DIR) - set(REMMINA_EXTERNAL_TOOLS_DIR "${REMMINA_DATADIR}/remmina/external_tools") - if(NOT REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR) - set(REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR "${REMMINA_EXTERNAL_TOOLS_DIR}") - endif() + set(REMMINA_EXTERNAL_TOOLS_DIR "${REMMINA_DATADIR}/remmina/external_tools") + if(NOT REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR) + set(REMMINA_RUNTIME_EXTERNAL_TOOLS_DIR "${REMMINA_EXTERNAL_TOOLS_DIR}") + endif() endif() option(SNAP_BUILD_ONLY "SNAP_BUILD_ONLY" OFF) if(SNAP_BUILD_ONLY) - if(NOT SNAPCRAFT) - message( - FATAL_ERROR "snapcraft not found, impossible to create only snap target") - endif() - return() + if(NOT SNAPCRAFT) + message( + FATAL_ERROR "snapcraft not found, impossible to create only snap target") + endif() + return() endif() if(SNAP_BUILD) - add_definitions(-DSNAP_BUILD) + add_definitions(-DSNAP_BUILD) endif() # Uninstall support @@ -362,40 +362,40 @@ endif() # cmake_uninstall.cmake.in in the module path #=========================================================== foreach( MODULE_PATH ${CMAKE_MODULE_PATH} ) - set( UNINSTALL_IN "${MODULE_PATH}/cmake_uninstall.cmake.in" ) - set( UNINSTALL_OUT "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) - if( EXISTS ${UNINSTALL_IN} ) - configure_file( "${UNINSTALL_IN}" - "${UNINSTALL_OUT}" - IMMEDIATE @ONLY - ) - if(WITH_CLEANUP) - message(STATUS "Remove folders during uninstall target") - add_definitions(-DREMOVE_DIRS) - set(UNINST_RMDIRS 1) - else() - message(STATUS "Folders won't be removed during uninstall target") - set(UNINST_RMDIRS 0) + set( UNINSTALL_IN "${MODULE_PATH}/cmake_uninstall.cmake.in" ) + set( UNINSTALL_OUT "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) + if( EXISTS ${UNINSTALL_IN} ) + configure_file("${UNINSTALL_IN}" + "${UNINSTALL_OUT}" + IMMEDIATE @ONLY + ) + if(WITH_CLEANUP) + message(STATUS "Remove folders during uninstall target") + add_definitions(-DREMOVE_DIRS) + set(UNINST_RMDIRS 1) + else() + message(STATUS "Folders won't be removed during uninstall target") + set(UNINST_RMDIRS 0) + endif() + add_custom_target(uninstall + "${CMAKE_COMMAND}" -DWITH_CLEANUP:BOOL=${WITH_CLEANUP} -P "${UNINSTALL_OUT}") + option(WITH_CLEANUP "Remove folders during uninstall target" OFF) + break() endif() - add_custom_target(uninstall - "${CMAKE_COMMAND}" -DWITH_CLEANUP:BOOL=${WITH_CLEANUP} -P "${UNINSTALL_OUT}") - option(WITH_CLEANUP "Remove folders during uninstall target" OFF) - break() - endif( EXISTS ${UNINSTALL_IN} ) -endforeach( MODULE_PATH ) +endforeach() #find_required_package(GTK) find_package(GLib REQUIRED) if(NOT GLib_FOUND) message(FATAL_ERROR "GLIB2 library not found") -endif(NOT GLib_FOUND) +endif() include_directories(${GLib_INCLUDE_DIRS}) include_directories(${GMODULE_INCLUDE_DIR}) find_package(GTK3 3.14.0 REQUIRED) if(NOT GTK3_FOUND) message(FATAL_ERROR "GTK3 library not found") -endif(NOT GTK3_FOUND) +endif() include_directories(${GTK3_INCLUDE_DIRS}) pkg_check_modules(wayland-client wayland-client) @@ -412,7 +412,7 @@ if(wayland-client_FOUND) ${Gmodule_LIBRARIES} ${GMODULE_LIBRARY} ${wayland-client_LIBRARIES} - ) + ) include_directories(${wayland-client_INCLUDE_DIRS}) message(STATUS "Wayland library found.") else() @@ -427,44 +427,44 @@ else() ${GIO_LIBRARY} ${Gmodule_LIBRARIES} ${GMODULE_LIBRARY} - ) + ) message(STATUS "Wayland library not found.") endif() set(CMAKE_THREAD_PREFER_PTHREAD TRUE) find_package(Threads REQUIRED) if(NOT CMAKE_USE_PTHREADS_INIT) - message(FATAL_ERROR "pthreads thread library not found") + message(FATAL_ERROR "pthreads thread library not found") endif() # Add GCC sanitizer options, must be done after pthreads detection see remmina # issue #1276 if(CMAKE_COMPILER_IS_GNUCC AND WITH_GCC_SANITIZE_ADDRESS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") endif() # LLVM coverage flags - https://clang.llvm.org/docs/SourceBasedCodeCoverage.html if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang" AND WITH_CLANG_COVERAGE) - message(STATUS "Enabling coverage.") - add_definitions(-DWITH_CLANG_COVERAGE) - set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -g -fprofile-instr-generate -fcoverage-mapping -ftest-coverage" - ) - set(CMAKE_EXE_LINKER_FLAGS - "${CMAKE_EXE_LINKER_FLAGS} -fprofile-instr-generate") + message(STATUS "Enabling coverage.") + add_definitions(-DWITH_CLANG_COVERAGE) + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS} -g -fprofile-instr-generate -fcoverage-mapping -ftest-coverage" + ) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -fprofile-instr-generate") elseif("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND WITH_GCC_PROFILING) - message(STATUS "Enabling profiling.") - add_definitions(-DWITH_GCC_PROFILING) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") + message(STATUS "Enabling profiling.") + add_definitions(-DWITH_GCC_PROFILING) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") endif() find_suggested_package(GCRYPT) find_package(OpenSSL) find_package(sodium REQUIRED) if(sodium_FOUND) - message(STATUS "sodium_LIBRARY_RELEASE: ${sodium_LIBRARY_RELEASE}") - message(STATUS "sodium_INCLUDE_DIR: ${sodium_INCLUDE_DIR}") - message(STATUS "sodium_LIBRARY_DEBUG: ${sodium_LIBRARY_DEBUG}") + message(STATUS "sodium_LIBRARY_RELEASE: ${sodium_LIBRARY_RELEASE}") + message(STATUS "sodium_INCLUDE_DIR: ${sodium_INCLUDE_DIR}") + message(STATUS "sodium_LIBRARY_DEBUG: ${sodium_LIBRARY_DEBUG}") endif() option(TOGTK4 "Disable deprecations to easy GTK4 migration") @@ -474,34 +474,34 @@ if(TOGTK4) endif() if(WITH_TRACE_CALLS) - message(STATUS "Enabling trace calls.") - add_definitions(-DWITH_TRACE_CALLS) + message(STATUS "Enabling trace calls.") + add_definitions(-DWITH_TRACE_CALLS) endif() option(WITH_NEWS "Disable online version checking" ON) if(WITH_NEWS) - message(STATUS "Enabling version check connecting to remmina.org") - add_definitions(-DWITH_NEWS) - set(RMNEWS_ENABLE_NEWS 1) + message(STATUS "Enabling version check connecting to remmina.org") + add_definitions(-DWITH_NEWS) + set(RMNEWS_ENABLE_NEWS 1) else() - message(STATUS "Disabling version check connecting to remmina.org") - set(RMNEWS_ENABLE_NEWS 0) + message(STATUS "Disabling version check connecting to remmina.org") + set(RMNEWS_ENABLE_NEWS 0) endif() option(WITH_MANPAGES "Build with MANPAGES" ON) if(WITH_MANPAGES) - message(STATUS "Enabling man pages.") - add_definitions(-DWITH_MANPAGES) + message(STATUS "Enabling man pages.") + add_definitions(-DWITH_MANPAGES) else() - message(STATUS "Man pages disabled") + message(STATUS "Man pages disabled") endif() if(GCRYPT_FOUND) - add_definitions(-DHAVE_LIBGCRYPT) + add_definitions(-DHAVE_LIBGCRYPT) endif() #avahi for discovery over mDNS/DNS-SD daemon -if (UNIX AND NOT APPLE) +if(UNIX AND NOT APPLE) find_suggested_package(Avahi) if(AVAHI_FOUND) message(STATUS "AVAHI_INCLUDE_DIRS=${AVAHI_INCLUDE_DIRS}") @@ -513,42 +513,42 @@ endif() option(WITH_ICON_CACHE "Generate the icon cache during install target" ON) if(WITH_ICON_CACHE) - message(STATUS "Icon cache will be generated") - add_definitions(-DWITH_ICON_CACHE) - find_program(XDG_ICON_RESOURCE NAMES xdg-icon-resource) - if(XDG_ICON_RESOURCE) - message(STATUS "Theme icon cache will be rebuilt") - add_custom_target(desktop-icon COMMAND ${XDG_ICON_RESOURCE} forceupdate - --theme hicolor) - else() - message(WARNING "Cannot update icon cache: xdg-icon-resource not found") - endif() + message(STATUS "Icon cache will be generated") + add_definitions(-DWITH_ICON_CACHE) + find_program(XDG_ICON_RESOURCE NAMES xdg-icon-resource) + if(XDG_ICON_RESOURCE) + message(STATUS "Theme icon cache will be rebuilt") + add_custom_target(desktop-icon COMMAND ${XDG_ICON_RESOURCE} forceupdate + --theme hicolor) + else() + message(WARNING "Cannot update icon cache: xdg-icon-resource not found") + endif() else() - message(STATUS "Icons cache won't be generated automatically") + message(STATUS "Icons cache won't be generated automatically") endif() option(WITH_UPDATE_DESKTOP_DB - "Generate desktop files MIME types cache database" ON) + "Generate desktop files MIME types cache database" ON) if(WITH_UPDATE_DESKTOP_DB) - message(STATUS "Desktop MIME types cache database enabled") - add_definitions(-DWITH_UPDATE_DESKTOP_DB) + message(STATUS "Desktop MIME types cache database enabled") + add_definitions(-DWITH_UPDATE_DESKTOP_DB) else() - message(STATUS "Desktop MIME types cache database won't be generated") + message(STATUS "Desktop MIME types cache database won't be generated") endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/generated/config.h) + ${CMAKE_CURRENT_BINARY_DIR}/generated/config.h) set(REMMINA_BUILD_CONFIG_LIST "") get_cmake_property(res VARIABLES) foreach(var ${res}) - if(var MATCHES "^WITH_*|^HAVE_*") - list(APPEND REMMINA_BUILD_CONFIG_LIST "${var}=${${var}}") - endif() + if(var MATCHES "^WITH_*|^HAVE_*") + list(APPEND REMMINA_BUILD_CONFIG_LIST "${var}=${${var}}") + endif() endforeach() string(REPLACE ";" " " REMMINA_BUILD_CONFIG "${REMMINA_BUILD_CONFIG_LIST}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in - ${CMAKE_CURRENT_BINARY_DIR}/generated/buildflags.h) + ${CMAKE_CURRENT_BINARY_DIR}/generated/buildflags.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}/generated/) # Configure RPATH @@ -556,8 +556,8 @@ set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) -if (NOT FREEBSD) - set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..") +if(NOT FREEBSD) + set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..") endif() if(GTK3_FOUND) @@ -570,6 +570,6 @@ if(GTK3_FOUND) endif() if(WITH_TRANSLATIONS) - add_subdirectory(po) + add_subdirectory(po) endif() diff --git a/plugins/rdp/rdp_plugin.c b/plugins/rdp/rdp_plugin.c index 31dcf370e..431bf59bd 100644 --- a/plugins/rdp/rdp_plugin.c +++ b/plugins/rdp/rdp_plugin.c @@ -2787,8 +2787,8 @@ static RemminaProtocolPlugin remmina_rdp = N_("RDP - Remote Desktop Protocol"), // Description GETTEXT_PACKAGE, // Translation domain remmina_plugin_rdp_version, // Version number - "org.remmina.Remmina-rdp-symbolic", // Icon for normal connection - "org.remmina.Remmina-rdp-ssh-symbolic", // Icon for SSH connection + "org.remmina.Remmina-rdp-symbolic", // Icon for normal connection + "org.remmina.Remmina-rdp-ssh-symbolic", // Icon for SSH connection remmina_rdp_basic_settings, // Array for basic settings remmina_rdp_advanced_settings, // Array for advanced settings REMMINA_PROTOCOL_SSH_SETTING_TUNNEL, // SSH settings type @@ -4139,10 +4139,7 @@ void rco_on_connect(RemminaProtocolWidget *gp, RemminaConnectionObject *cnnobj) { TRACE_CALL(__func__); - gchar *last_success; - REMMINA_DEBUG("Connect signal emitted"); - GDateTime *date = g_date_time_new_now_utc(); /* This signal handler is called by a plugin when it’s correctly connected * (and authenticated) */ @@ -4155,17 +4152,14 @@ void rco_on_connect(RemminaProtocolWidget *gp, RemminaConnectionObject *cnnobj) /** Remember recent list for quick connect, and save the current date * in the last_used field. */ - last_success = g_strdup_printf("%d%02d%02d", - g_date_time_get_year(date), - g_date_time_get_month(date), - g_date_time_get_day_of_month(date)); if (remmina_file_get_filename(cnnobj->remmina_file) == NULL) remmina_pref_add_recent(remmina_file_get_string(cnnobj->remmina_file, "protocol"), remmina_file_get_string(cnnobj->remmina_file, "server")); if (remmina_pref.periodic_usage_stats_permitted) { REMMINA_DEBUG("Stats are allowed, we save the last successful connection date"); - remmina_file_set_string(cnnobj->remmina_file, "last_success", last_success); - REMMINA_DEBUG("Last connection made on %s.", last_success); + //remmina_file_set_string(cnnobj->remmina_file, "last_success", last_success); + remmina_file_state_last_success(cnnobj->remmina_file); + //REMMINA_DEBUG("Last connection made on %s.", last_success); } REMMINA_DEBUG("Saving credentials"); diff --git a/src/remmina_file.c b/src/remmina_file.c index c9f6517c8..497e3933b 100644 --- a/src/remmina_file.c +++ b/src/remmina_file.c @@ -67,6 +67,7 @@ #define MIN_WINDOW_HEIGHT 10 #define KEYFILE_GROUP_REMMINA "remmina" +#define KEYFILE_GROUP_STATE "Remmina Connection States" static struct timespec times[2]; @@ -78,6 +79,7 @@ remmina_file_new_empty(void) remminafile = g_new0(RemminaFile, 1); remminafile->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + remminafile->states = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); /* spsettings contains settings that are loaded from the secure_plugin. * it’s used by remmina_file_store_secret_plugin_password() to know * where to change */ @@ -182,6 +184,22 @@ void remmina_file_set_filename(RemminaFile *remminafile, const gchar *filename) remminafile->filename = g_strdup(filename); } +void remmina_file_set_statefile(RemminaFile *remminafile) +{ + TRACE_CALL(__func__); + + if (!remminafile) + return; + else + g_free(remminafile->statefile); + + gchar *basename = g_path_get_basename (remminafile->filename); + gchar *cachedir = g_build_path("/", g_get_user_cache_dir(), "remmina", NULL); + GString *fname = g_string_new(g_strdup(basename)); + + remminafile->statefile = g_strdup_printf("%s/%s.state", cachedir, fname->str); +} + const gchar * remmina_file_get_filename(RemminaFile *remminafile) { @@ -189,6 +207,13 @@ remmina_file_get_filename(RemminaFile *remminafile) return remminafile->filename; } +const gchar * +remmina_file_get_statefile(RemminaFile *remminafile) +{ + TRACE_CALL(__func__); + return remminafile->statefile; +} + RemminaFile * remmina_file_copy(const gchar *filename) { @@ -415,6 +440,8 @@ remmina_file_load(const gchar *filename) remminafile = NULL; } + remmina_file_set_statefile(remminafile); + g_key_file_free(gkeyfile); return remminafile; @@ -429,20 +456,31 @@ void remmina_file_set_string(RemminaFile *remminafile, const gchar *setting, con void remmina_file_set_string_ref(RemminaFile *remminafile, const gchar *setting, gchar *value) { TRACE_CALL(__func__); - const gchar *message; if (value) { /* We refuse to accept to set the "resolution" field */ if (strcmp(setting, "resolution") == 0) { - message = "WARNING: the “resolution” setting in .pref files is deprecated, but some code in remmina or in a plugin is trying to set it.\n"; - fputs(message, stdout); + // TRANSLATORS: This is a message that pop-up when an external Remmina plugin tries to set the windows resolution using a legacy parameter. + const gchar *message = _("Using the «resolution» parameter in the Remmina preferences file is deprecated.\n"); + REMMINA_CRITICAL(message); remmina_main_show_warning_dialog(message); return; } g_hash_table_insert(remminafile->settings, g_strdup(setting), value); - } else { + } else g_hash_table_insert(remminafile->settings, g_strdup(setting), g_strdup("")); - } + +} + +void remmina_file_set_state(RemminaFile *remminafile, const gchar *setting, gchar *value) +{ + TRACE_CALL(__func__); + + if(value && value[0] != 0) { + g_hash_table_insert(remminafile->states, g_strdup(setting), g_strdup(value)); + } else + g_hash_table_insert(remminafile->states, g_strdup(setting), g_strdup("")); + } const gchar * @@ -450,7 +488,6 @@ remmina_file_get_string(RemminaFile *remminafile, const gchar *setting) { TRACE_CALL(__func__); gchar *value; - const gchar *message; /* Returned value is a pointer to the string stored on the hash table, * please do not free it or the hash table will contain invalid pointer */ @@ -470,8 +507,9 @@ remmina_file_get_string(RemminaFile *remminafile, const gchar *setting) } if (strcmp(setting, "resolution") == 0) { - message = "WARNING: the “resolution” setting in .pref files is deprecated, but some code in remmina or in a plugin is trying to read it.\n"; - fputs(message, stdout); + // TRANSLATORS: This is a message that pop-up when an external Remmina plugin tries to set the windows resolution using a legacy parameter. + const gchar *message = _("Using the «resolution» parameter in the Remmina preferences file is deprecated.\n"); + REMMINA_CRITICAL(message); remmina_main_show_warning_dialog(message); return NULL; } @@ -585,6 +623,8 @@ void remmina_file_free(RemminaFile *remminafile) if (remminafile->filename) g_free(remminafile->filename); + if (remminafile->statefile) + g_free(remminafile->statefile); if (remminafile->settings) g_hash_table_destroy(remminafile->settings); if (remminafile->spsettings) @@ -619,10 +659,10 @@ void remmina_file_save(RemminaFile *remminafile) nopasswdsave = remmina_file_get_int(remminafile, "disablepasswordstoring", 0); /* Identify the protocol plugin and get pointers to its RemminaProtocolSetting structs */ proto = (gchar *)g_hash_table_lookup(remminafile->settings, "protocol"); - if (proto) { + if (proto) protocol_plugin = (RemminaProtocolPlugin *)remmina_plugin_manager_get_plugin(REMMINA_PLUGIN_TYPE_PROTOCOL, proto); - } else { - g_warning("Saving settings for unknown protocol, because remminafile has non proto key\n"); + else { + REMMINA_CRITICAL("Saving settings for unknown protocol:", proto); protocol_plugin = NULL; } @@ -770,6 +810,57 @@ void remmina_file_delete(const gchar *filename) g_unlink(filename); } +const gchar * +remmina_file_get_state(RemminaFile *remminafile, const gchar *setting) +{ + TRACE_CALL(__func__); + g_autoptr(GError) error = NULL; + g_autoptr(GKeyFile) key_file = g_key_file_new (); + + if (!g_key_file_load_from_file (key_file, remminafile->statefile, G_KEY_FILE_NONE, &error)) { + if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) + REMMINA_CRITICAL ("Error loading state file: %s", error->message); + return NULL; + } + + g_autofree gchar *val = g_key_file_get_string (key_file, KEYFILE_GROUP_STATE, setting, &error); + if (val == NULL && + !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) { + REMMINA_CRITICAL ("Error finding %s in state file %s: %s", + setting, remminafile->statefile, error->message); + return NULL; + } + return val && val[0] ? val : NULL; +} + + +void remmina_file_state_last_success(RemminaFile *remminafile) +{ + TRACE_CALL(__func__); + + g_autoptr(GKeyFile) key_statefile = g_key_file_new (); + g_autoptr(GKeyFile) key_remminafile = g_key_file_new (); + g_autoptr(GError) error = NULL; + + const gchar *date = NULL; + GDateTime *d = g_date_time_new_now_utc(); + + date = g_strdup_printf("%d%02d%02d", + g_date_time_get_year(d), + g_date_time_get_month(d), + g_date_time_get_day_of_month(d)); + + g_key_file_set_string (key_statefile, KEYFILE_GROUP_STATE, "last_success", date); + + if (!g_key_file_save_to_file (key_statefile, remminafile->statefile, &error)) { + REMMINA_CRITICAL ("Error saving key file: %s", error->message); + return; + } + /* Delete old pre-1.5 keys */ + g_key_file_remove_key(key_remminafile, KEYFILE_GROUP_REMMINA, "last_success", NULL); + REMMINA_DEBUG("Last connection made on %s.", date); +} + void remmina_file_unsave_passwords(RemminaFile *remminafile) { /* Delete all saved secrets for this profile */ @@ -813,10 +904,10 @@ void remmina_file_unsave_passwords(RemminaFile *remminafile) } /** - * Return the string date of the last time a file has been modified. + * Return the string date of the last time a Remmina state file has been modified. * * This is used to return the modification date of a file and it’s used - * to return the modification date and time of a givwn remmina file. + * to return the modification date and time of a given remmina file. * If it fails it will return "26/01/1976 23:30:00", that is just a date to don't * return an empty string (challenge: what was happened that day at that time?). * @return A date string in the form "%d/%m/%Y %H:%M:%S". @@ -837,7 +928,12 @@ remmina_file_get_datetime(RemminaFile *remminafile) guint64 mtime; gchar *modtime_string; - file = g_file_new_for_path(remminafile->filename); + + if (remminafile->statefile) { + //REMMINA_DEBUG ("remminafile->statefile: %s", remminafile->statefile); + file = g_file_new_for_path(remminafile->statefile); + } else + file = g_file_new_for_path(remminafile->filename); info = g_file_query_info(file, G_FILE_ATTRIBUTE_TIME_MODIFIED, @@ -848,11 +944,29 @@ remmina_file_get_datetime(RemminaFile *remminafile) g_object_unref(file); if (info == NULL) { - g_print("couldn’t get time info\n"); - return "26/01/1976 23:30:00"; + //REMMINA_DEBUG("couldn’t get time info"); + + mtime = 191543400; + const gchar *last_success = remmina_file_get_string(remminafile, "last_success"); + if (last_success) { + //REMMINA_DEBUG ("Last success is %s", last_success); + GDateTime *dt; + dt = g_date_time_new_from_iso8601 (g_strconcat (last_success,"T00:00:00Z", NULL), NULL); + if (dt) { + //REMMINA_DEBUG("Converting last_success"); + mtime = g_ascii_strtoull (g_date_time_format(dt, "%s"), NULL, 10); + g_date_time_unref (dt); + } else { + //REMMINA_DEBUG("dt was null"); + mtime = 191543400; + } + } + //return g_strdup ("26/01/1976 23:30:00"); + } else { + mtime = g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_TIME_MODIFIED); + g_object_unref(info); } - mtime = g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_TIME_MODIFIED); tv.tv_sec = mtime; ptm = localtime(&tv.tv_sec); @@ -860,7 +974,6 @@ remmina_file_get_datetime(RemminaFile *remminafile) modtime_string = g_locale_to_utf8(time_string, -1, NULL, NULL, NULL); - g_object_unref(info); return modtime_string; } @@ -880,19 +993,19 @@ remmina_file_touch(RemminaFile *remminafile) struct stat st; int r; - if ((r = stat(remminafile->filename, &st)) < 0) { + if ((r = stat(remminafile->statefile, &st)) < 0) { if (errno != ENOENT) - REMMINA_DEBUG("stat %s:", remminafile->filename); + REMMINA_DEBUG("stat %s:", remminafile->statefile); } else if (!r) { times[0] = st.st_atim; times[1] = st.st_mtim; - if (utimensat(AT_FDCWD, remminafile->filename, times, 0) < 0) - REMMINA_DEBUG("utimensat %s:", remminafile->filename); + if (utimensat(AT_FDCWD, remminafile->statefile, times, 0) < 0) + REMMINA_DEBUG("utimensat %s:", remminafile->statefile); return; } - if ((fd = open(remminafile->filename, O_CREAT | O_EXCL, 0644)) < 0) - REMMINA_DEBUG("open %s:", remminafile->filename); + if ((fd = open(remminafile->statefile, O_CREAT | O_EXCL, 0644)) < 0) + REMMINA_DEBUG("open %s:", remminafile->statefile); close(fd); remmina_file_touch(remminafile); diff --git a/src/remmina_file.h b/src/remmina_file.h index b025dd287..5915457c0 100644 --- a/src/remmina_file.h +++ b/src/remmina_file.h @@ -34,6 +34,9 @@ * */ +#include <glib-object.h> +#include <gobject/gvaluecollector.h> + #include "remmina/types.h" #pragma once @@ -45,6 +48,7 @@ struct _RemminaFile { // @todo Add a cache file with content remminafile->filename = last_success gchar * statefile; GHashTable * settings; + GHashTable * states; GHashTable * spsettings; gboolean prevent_saving; }; @@ -78,13 +82,17 @@ RemminaFile *remmina_file_new(void); RemminaFile *remmina_file_copy(const gchar *filename); void remmina_file_generate_filename(RemminaFile *remminafile); void remmina_file_set_filename(RemminaFile *remminafile, const gchar *filename); +void remmina_file_set_statefile(RemminaFile *remminafile); +void remmina_file_state_last_success(RemminaFile *remminafile); const gchar *remmina_file_get_filename(RemminaFile *remminafile); +const gchar *remmina_file_get_statefile(RemminaFile *remminafile); /* Load a new .remmina file and return the allocated RemminaFile object */ RemminaFile *remmina_file_load(const gchar *filename); /* Settings get/set functions */ void remmina_file_set_string(RemminaFile *remminafile, const gchar *setting, const gchar *value); void remmina_file_set_string_ref(RemminaFile *remminafile, const gchar *setting, gchar *value); const gchar *remmina_file_get_string(RemminaFile *remminafile, const gchar *setting); +const gchar *remmina_file_get_state(RemminaFile *remminafile, const gchar *setting); gchar *remmina_file_get_secret(RemminaFile *remminafile, const gchar *setting); gchar *remmina_file_format_properties(RemminaFile *remminafile, const gchar *setting); void remmina_file_set_int(RemminaFile *remminafile, const gchar *setting, gint value); diff --git a/src/remmina_log.h b/src/remmina_log.h index c7b86d5e0..65f50bf4a 100644 --- a/src/remmina_log.h +++ b/src/remmina_log.h @@ -36,6 +36,7 @@ #pragma once #include <stdarg.h> +#include <glib.h> G_BEGIN_DECLS diff --git a/src/remmina_main.c b/src/remmina_main.c index a2d1b67fa..a93579988 100644 --- a/src/remmina_main.c +++ b/src/remmina_main.c @@ -486,6 +486,7 @@ static void remmina_main_load_file_tree_callback(RemminaFile *remminafile, gpoin remmina_file_get_string(remminafile, "group")); datetime = remmina_file_get_datetime(remminafile); + REMMINA_DEBUG ("Date is: %s", datetime); gtk_tree_store_append(store, &child, (found ? &iter : NULL)); gtk_tree_store_set(store, &child, PROTOCOL_COLUMN, remmina_file_get_icon_name(remminafile), diff --git a/src/remmina_protocol_widget.c b/src/remmina_protocol_widget.c index f93973aeb..f322f1628 100644 --- a/src/remmina_protocol_widget.c +++ b/src/remmina_protocol_widget.c @@ -364,11 +364,10 @@ static gboolean conn_opened(gpointer data) { TRACE_CALL(__func__); RemminaProtocolWidget *gp = (RemminaProtocolWidget *)data; - guint i; #ifdef HAVE_LIBSSH if (gp->priv->ssh_tunnels) { - for(i = 0;i < gp->priv->ssh_tunnels->len; i++) { + for(guint i = 0;i < gp->priv->ssh_tunnels->len; i++) { remmina_ssh_tunnel_cancel_accept((RemminaSSHTunnel *)gp->priv->ssh_tunnels->pdata[i]); } } @@ -387,7 +386,7 @@ static gboolean conn_opened(gpointer data) void remmina_protocol_widget_signal_connection_opened(RemminaProtocolWidget *gp) { - /* Plugin told us that it closed the connection, + /* Plugin told us that it opened the connection, * add async event to main thread to complete our close tasks */ TRACE_CALL(__func__); g_idle_add(conn_opened, (gpointer)gp); @@ -486,7 +485,6 @@ void remmina_protocol_widget_close_connection(RemminaProtocolWidget *gp) return; } - /** Check if the plugin accepts keystrokes. */ gboolean remmina_protocol_widget_plugin_receives_keystrokes(RemminaProtocolWidget *gp) @@ -729,7 +727,7 @@ void remmina_protocol_widget_emit_signal(RemminaProtocolWidget *gp, const gchar { TRACE_CALL(__func__); - g_print("Emitting signals should be used from the object itself, not from another object\n"); + REMMINA_DEBUG("Emitting signals should be used from the object itself, not from another object"); raise(SIGINT); if (!remmina_masterthread_exec_is_main_thread()) { diff --git a/src/remmina_ssh_plugin.c b/src/remmina_ssh_plugin.c index 7f17fe387..8a8c33257 100644 --- a/src/remmina_ssh_plugin.c +++ b/src/remmina_ssh_plugin.c @@ -367,7 +367,7 @@ remmina_plugin_ssh_main_thread(gpointer data) } BREAK: - REMMINA_DEBUG("Authentication terminted with exit status %d", ret); + REMMINA_DEBUG("Authentication terminated with exit status %d", ret); g_free(hostport); |