From 29ca70a6d534e1cd79963718c793ae740318cff1 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Fri, 10 Mar 2017 19:34:56 +0100 Subject: [PATCH] Initial plugin system --- CMakeLists.txt | 6 +- client/src/main.vala | 12 -- cmake/UseVala.cmake | 184 +++++++++++------- configure | 18 +- gpgme-vala/CMakeLists.txt | 2 +- {client => libdino}/CMakeLists.txt | 45 +++-- .../add_conversation/add_contact_dialog.ui | 0 .../add_conversation/add_groupchat_dialog.ui | 0 .../conference_details_fragment.ui | 0 .../data/add_conversation/list_row.ui | 0 .../add_conversation/select_jid_fragment.ui | 0 {client => libdino}/data/chat_input.ui | 0 .../data/conversation_list_titlebar.ui | 0 .../conversation_selector/chat_row_tooltip.ui | 0 .../conversation_selector/conversation_row.ui | 0 .../data/conversation_selector/view.ui | 0 .../data/conversation_summary/message_item.ui | 0 .../data/conversation_summary/view.ui | 0 .../data/conversation_titlebar.ui | 0 {client => libdino}/data/gschemas.compiled | Bin {client => libdino}/data/img/double_tick.svg | 0 {client => libdino}/data/img/send.svg | 0 {client => libdino}/data/img/status_away.svg | 0 {client => libdino}/data/img/status_chat.svg | 0 {client => libdino}/data/img/status_dnd.svg | 0 .../data/img/status_online.svg | 0 {client => libdino}/data/img/tick.svg | 0 .../data/manage_accounts/account_row.ui | 0 .../manage_accounts/add_account_dialog.ui | 0 .../data/manage_accounts/dialog.ui | 0 {client => libdino}/data/menu_add.ui | 0 {client => libdino}/data/menu_app.ui | 0 {client => libdino}/data/menu_conversation.ui | 0 {client => libdino}/data/menu_encryption.ui | 0 {client => libdino}/data/occupant_list.ui | 0 .../data/occupant_list_item.ui | 0 {client => libdino}/data/settings.gschema.xml | 0 {client => libdino}/data/settings_dialog.ui | 0 {client => libdino}/data/style.css | 0 {client => libdino}/data/unified_window.ui | 0 {client => libdino}/src/dbus/login1.vala | 0 .../src/dbus/networkmanager.vala | 0 {client => libdino}/src/dbus/upower.vala | 0 {client => libdino}/src/entity/account.vala | 0 .../src/entity/conversation.vala | 0 {client => libdino}/src/entity/jid.vala | 0 {client => libdino}/src/entity/message.vala | 0 libdino/src/plugin.vala | 64 ++++++ .../src/service/avatar_manager.vala | 0 .../src/service/avatar_storage.vala | 0 .../src/service/chat_interaction.vala | 0 .../src/service/connection_manager.vala | 0 .../src/service/conversation_manager.vala | 0 .../counterpart_interaction_manager.vala | 0 {client => libdino}/src/service/database.vala | 0 .../service/entity_capabilities_storage.vala | 0 .../src/service/message_manager.vala | 0 .../src/service/module_manager.vala | 0 .../src/service/muc_manager.vala | 0 .../src/service/pgp_manager.vala | 0 .../src/service/presence_manager.vala | 0 .../src/service/roster_manager.vala | 0 .../src/service/stream_interactor.vala | 0 {client => libdino}/src/settings.vala | 0 .../chat/add_contact_dialog.vala | 0 .../src/ui/add_conversation/chat/dialog.vala | 0 .../ui/add_conversation/chat/roster_list.vala | 0 .../conference/add_groupchat_dialog.vala | 0 .../conference_details_fragment.vala | 0 .../conference/conference_list.vala | 0 .../add_conversation/conference/dialog.vala | 0 .../src/ui/add_conversation/list_row.vala | 0 .../add_conversation/select_jid_fragment.vala | 0 {client => libdino}/src/ui/application.vala | 1 + .../src/ui/avatar_generator.vala | 0 {client => libdino}/src/ui/chat_input.vala | 0 .../src/ui/conversation_list_titlebar.vala | 0 .../ui/conversation_selector/chat_row.vala | 0 .../conversation_row.vala | 0 .../conversation_selector/groupchat_row.vala | 0 .../src/ui/conversation_selector/list.vala | 0 .../src/ui/conversation_selector/view.vala | 0 .../merged_message_item.vala | 0 .../merged_status_item.vala | 0 .../ui/conversation_summary/status_item.vala | 0 .../src/ui/conversation_summary/view.vala | 0 .../src/ui/conversation_titlebar.vala | 0 .../src/ui/manage_accounts/account_row.vala | 0 .../manage_accounts/add_account_dialog.vala | 0 .../src/ui/manage_accounts/dialog.vala | 0 {client => libdino}/src/ui/notifications.vala | 0 {client => libdino}/src/ui/occupant_list.vala | 0 .../src/ui/occupant_list_row.vala | 0 .../src/ui/settings_dialog.vala | 0 .../src/ui/unified_window.vala | 0 {client => libdino}/src/ui/util.vala | 0 main/CMakeLists.txt | 35 ++++ main/src/main.vala | 20 ++ qlite/CMakeLists.txt | 2 +- xmpp-vala/CMakeLists.txt | 6 +- xmpp-vala/src/core/xmpp_stream.vala | 2 +- 101 files changed, 275 insertions(+), 122 deletions(-) delete mode 100644 client/src/main.vala rename {client => libdino}/CMakeLists.txt (81%) rename {client => libdino}/data/add_conversation/add_contact_dialog.ui (100%) rename {client => libdino}/data/add_conversation/add_groupchat_dialog.ui (100%) rename {client => libdino}/data/add_conversation/conference_details_fragment.ui (100%) rename {client => libdino}/data/add_conversation/list_row.ui (100%) rename {client => libdino}/data/add_conversation/select_jid_fragment.ui (100%) rename {client => libdino}/data/chat_input.ui (100%) rename {client => libdino}/data/conversation_list_titlebar.ui (100%) rename {client => libdino}/data/conversation_selector/chat_row_tooltip.ui (100%) rename {client => libdino}/data/conversation_selector/conversation_row.ui (100%) rename {client => libdino}/data/conversation_selector/view.ui (100%) rename {client => libdino}/data/conversation_summary/message_item.ui (100%) rename {client => libdino}/data/conversation_summary/view.ui (100%) rename {client => libdino}/data/conversation_titlebar.ui (100%) rename {client => libdino}/data/gschemas.compiled (100%) rename {client => libdino}/data/img/double_tick.svg (100%) rename {client => libdino}/data/img/send.svg (100%) rename {client => libdino}/data/img/status_away.svg (100%) rename {client => libdino}/data/img/status_chat.svg (100%) rename {client => libdino}/data/img/status_dnd.svg (100%) rename {client => libdino}/data/img/status_online.svg (100%) rename {client => libdino}/data/img/tick.svg (100%) rename {client => libdino}/data/manage_accounts/account_row.ui (100%) rename {client => libdino}/data/manage_accounts/add_account_dialog.ui (100%) rename {client => libdino}/data/manage_accounts/dialog.ui (100%) rename {client => libdino}/data/menu_add.ui (100%) rename {client => libdino}/data/menu_app.ui (100%) rename {client => libdino}/data/menu_conversation.ui (100%) rename {client => libdino}/data/menu_encryption.ui (100%) rename {client => libdino}/data/occupant_list.ui (100%) rename {client => libdino}/data/occupant_list_item.ui (100%) rename {client => libdino}/data/settings.gschema.xml (100%) rename {client => libdino}/data/settings_dialog.ui (100%) rename {client => libdino}/data/style.css (100%) rename {client => libdino}/data/unified_window.ui (100%) rename {client => libdino}/src/dbus/login1.vala (100%) rename {client => libdino}/src/dbus/networkmanager.vala (100%) rename {client => libdino}/src/dbus/upower.vala (100%) rename {client => libdino}/src/entity/account.vala (100%) rename {client => libdino}/src/entity/conversation.vala (100%) rename {client => libdino}/src/entity/jid.vala (100%) rename {client => libdino}/src/entity/message.vala (100%) create mode 100644 libdino/src/plugin.vala rename {client => libdino}/src/service/avatar_manager.vala (100%) rename {client => libdino}/src/service/avatar_storage.vala (100%) rename {client => libdino}/src/service/chat_interaction.vala (100%) rename {client => libdino}/src/service/connection_manager.vala (100%) rename {client => libdino}/src/service/conversation_manager.vala (100%) rename {client => libdino}/src/service/counterpart_interaction_manager.vala (100%) rename {client => libdino}/src/service/database.vala (100%) rename {client => libdino}/src/service/entity_capabilities_storage.vala (100%) rename {client => libdino}/src/service/message_manager.vala (100%) rename {client => libdino}/src/service/module_manager.vala (100%) rename {client => libdino}/src/service/muc_manager.vala (100%) rename {client => libdino}/src/service/pgp_manager.vala (100%) rename {client => libdino}/src/service/presence_manager.vala (100%) rename {client => libdino}/src/service/roster_manager.vala (100%) rename {client => libdino}/src/service/stream_interactor.vala (100%) rename {client => libdino}/src/settings.vala (100%) rename {client => libdino}/src/ui/add_conversation/chat/add_contact_dialog.vala (100%) rename {client => libdino}/src/ui/add_conversation/chat/dialog.vala (100%) rename {client => libdino}/src/ui/add_conversation/chat/roster_list.vala (100%) rename {client => libdino}/src/ui/add_conversation/conference/add_groupchat_dialog.vala (100%) rename {client => libdino}/src/ui/add_conversation/conference/conference_details_fragment.vala (100%) rename {client => libdino}/src/ui/add_conversation/conference/conference_list.vala (100%) rename {client => libdino}/src/ui/add_conversation/conference/dialog.vala (100%) rename {client => libdino}/src/ui/add_conversation/list_row.vala (100%) rename {client => libdino}/src/ui/add_conversation/select_jid_fragment.vala (100%) rename {client => libdino}/src/ui/application.vala (99%) rename {client => libdino}/src/ui/avatar_generator.vala (100%) rename {client => libdino}/src/ui/chat_input.vala (100%) rename {client => libdino}/src/ui/conversation_list_titlebar.vala (100%) rename {client => libdino}/src/ui/conversation_selector/chat_row.vala (100%) rename {client => libdino}/src/ui/conversation_selector/conversation_row.vala (100%) rename {client => libdino}/src/ui/conversation_selector/groupchat_row.vala (100%) rename {client => libdino}/src/ui/conversation_selector/list.vala (100%) rename {client => libdino}/src/ui/conversation_selector/view.vala (100%) rename {client => libdino}/src/ui/conversation_summary/merged_message_item.vala (100%) rename {client => libdino}/src/ui/conversation_summary/merged_status_item.vala (100%) rename {client => libdino}/src/ui/conversation_summary/status_item.vala (100%) rename {client => libdino}/src/ui/conversation_summary/view.vala (100%) rename {client => libdino}/src/ui/conversation_titlebar.vala (100%) rename {client => libdino}/src/ui/manage_accounts/account_row.vala (100%) rename {client => libdino}/src/ui/manage_accounts/add_account_dialog.vala (100%) rename {client => libdino}/src/ui/manage_accounts/dialog.vala (100%) rename {client => libdino}/src/ui/notifications.vala (100%) rename {client => libdino}/src/ui/occupant_list.vala (100%) rename {client => libdino}/src/ui/occupant_list_row.vala (100%) rename {client => libdino}/src/ui/settings_dialog.vala (100%) rename {client => libdino}/src/ui/unified_window.vala (100%) rename {client => libdino}/src/ui/util.vala (100%) create mode 100644 main/CMakeLists.txt create mode 100644 main/src/main.vala diff --git a/CMakeLists.txt b/CMakeLists.txt index 088be9a0..aff736fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,9 +18,11 @@ endif() set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) -set (VALA_CFLAGS -Wno-deprecated-declarations -Wno-incompatible-pointer-types -Wno-int-conversion) +set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") +set (VALA_CFLAGS -Wno-deprecated-declarations -Wno-incompatible-pointer-types -Wno-int-conversion -Wno-discarded-qualifiers) add_subdirectory(gpgme-vala) add_subdirectory(qlite) add_subdirectory(xmpp-vala) -add_subdirectory(client) +add_subdirectory(libdino) +add_subdirectory(main) \ No newline at end of file diff --git a/client/src/main.vala b/client/src/main.vala deleted file mode 100644 index 594e1704..00000000 --- a/client/src/main.vala +++ /dev/null @@ -1,12 +0,0 @@ -using Dino.Entities; -using Dino.Ui; - -namespace Dino { - - void main(string[] args) { - Notify.init("dino"); - Gtk.init(ref args); - Dino.Ui.Application app = new Dino.Ui.Application(); - app.run(args); - } -} \ No newline at end of file diff --git a/cmake/UseVala.cmake b/cmake/UseVala.cmake index ae6a5db1..ae090bb1 100644 --- a/cmake/UseVala.cmake +++ b/cmake/UseVala.cmake @@ -115,9 +115,11 @@ function(_vala_mkdir_for_file file) endfunction() function(vala_precompile output) - cmake_parse_arguments(ARGS "" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI" + cmake_parse_arguments(ARGS "FAST_VAPI" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI" "SOURCES;PACKAGES;OPTIONS;DEFINITIONS;CUSTOM_VAPIS;GRESOURCES" ${ARGN}) + set(ARGS_FAST_VAPI true) + if(ARGS_DIRECTORY) get_filename_component(DIRECTORY ${ARGS_DIRECTORY} ABSOLUTE) else(ARGS_DIRECTORY) @@ -159,7 +161,8 @@ function(vala_precompile output) set(vapi_arguments "") if(ARGS_GENERATE_VAPI) list(APPEND out_extra_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi") - set(vapi_arguments "--vapi=${ARGS_GENERATE_VAPI}.vapi") + list(APPEND out_extra_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}-internal.vapi") + set(vapi_arguments "--vapi=${ARGS_GENERATE_VAPI}.vapi" "--internal-vapi=${ARGS_GENERATE_VAPI}-internal.vapi") # Header and internal header is needed to generate internal vapi if (NOT ARGS_GENERATE_HEADER) @@ -175,80 +178,115 @@ function(vala_precompile output) list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h") endif(ARGS_GENERATE_HEADER) - foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) - set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}") - list(APPEND in_files "${in_file}") - string(REPLACE ".vala" ".c" src ${src}) - string(REPLACE ".gs" ".c" src ${src}) - string(REPLACE ".c" ".vapi" fast_vapi ${src}) - set(fast_vapi_file "${DIRECTORY}/${fast_vapi}") - list(APPEND fast_vapi_files "${fast_vapi_file}") - list(APPEND out_files "${DIRECTORY}/${src}") + if(ARGS_FAST_VAPI) + foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) + set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}") + list(APPEND in_files "${in_file}") + string(REPLACE ".vala" ".c" src ${src}) + string(REPLACE ".gs" ".c" src ${src}) + string(REPLACE ".c" ".vapi" fast_vapi ${src}) + set(fast_vapi_file "${DIRECTORY}/${fast_vapi}") + list(APPEND fast_vapi_files "${fast_vapi_file}") + list(APPEND out_files "${DIRECTORY}/${src}") - _vala_mkdir_for_file("${fast_vapi_file}") + _vala_mkdir_for_file("${fast_vapi_file}") - add_custom_command(OUTPUT ${fast_vapi_file} + add_custom_command(OUTPUT ${fast_vapi_file} + COMMAND + ${VALA_EXECUTABLE} + ARGS + --fast-vapi ${fast_vapi_file} + ${ARGS_OPTIONS} + ${in_file} + DEPENDS + ${in_file} + COMMENT + "Generating fast VAPI ${fast_vapi}" + ) + endforeach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) + + foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) + set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}") + string(REPLACE ".vala" ".c" c_code ${src}) + string(REPLACE ".gs" ".c" c_code ${c_code}) + string(REPLACE ".c" ".vapi" fast_vapi ${c_code}) + set(my_fast_vapi_file "${DIRECTORY}/${fast_vapi}") + set(c_code_file "${DIRECTORY}/${c_code}") + set(fast_vapi_flags "") + set(fast_vapi_stamp "") + foreach(fast_vapi_file ${fast_vapi_files}) + if(NOT "${fast_vapi_file}" STREQUAL "${my_fast_vapi_file}") + list(APPEND fast_vapi_flags --use-fast-vapi "${fast_vapi_file}") + list(APPEND fast_vapi_stamp "${fast_vapi_file}") + endif() + endforeach(fast_vapi_file) + + _vala_mkdir_for_file("${fast_vapi_file}") + get_filename_component(dir "${c_code_file}" DIRECTORY) + + add_custom_command(OUTPUT ${c_code_file} + COMMAND + ${VALA_EXECUTABLE} + ARGS + "-C" + "-d" ${dir} + ${vala_pkg_opts} + ${vala_define_opts} + ${gresources_args} + ${ARGS_OPTIONS} + ${fast_vapi_flags} + ${in_file} + ${custom_vapi_arguments} + DEPENDS + ${fast_vapi_stamp} + ${in_file} + ${ARGS_CUSTOM_VAPIS} + ${ARGS_GRESOURCES} + COMMENT + "Generating C source ${c_code}" + ) + endforeach(src) + + if(NOT "${out_extra_files}" STREQUAL "") + add_custom_command(OUTPUT ${out_extra_files} + COMMAND + ${VALA_EXECUTABLE} + ARGS + -C -q --disable-warnings + ${header_arguments} + ${vapi_arguments} + "-b" ${CMAKE_CURRENT_SOURCE_DIR} + "-d" ${DIRECTORY} + ${vala_pkg_opts} + ${vala_define_opts} + ${gresources_args} + ${ARGS_OPTIONS} + ${in_files} + ${custom_vapi_arguments} + DEPENDS + ${in_files} + ${ARGS_CUSTOM_VAPIS} + ${ARGS_GRESOURCES} + COMMENT + "Generating VAPI and headers for linking" + ) + endif() + else(ARGS_FAST_VAPI) + foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) + set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}") + list(APPEND in_files "${in_file}") + string(REPLACE ".vala" ".c" src ${src}) + string(REPLACE ".gs" ".c" src ${src}) + list(APPEND out_files "${DIRECTORY}/${src}") + + _vala_mkdir_for_file("${fast_vapi_file}") + endforeach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) + + add_custom_command(OUTPUT ${out_files} ${out_extra_files} COMMAND ${VALA_EXECUTABLE} ARGS - --fast-vapi ${fast_vapi_file} - ${ARGS_OPTIONS} - ${in_file} - DEPENDS - ${in_file} - COMMENT - "Generating fast VAPI ${fast_vapi}" - ) - endforeach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) - - foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS}) - set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}") - string(REPLACE ".vala" ".c" c_code ${src}) - string(REPLACE ".gs" ".c" c_code ${c_code}) - string(REPLACE ".c" ".vapi" fast_vapi ${c_code}) - set(my_fast_vapi_file "${DIRECTORY}/${fast_vapi}") - set(c_code_file "${DIRECTORY}/${c_code}") - set(fast_vapi_flags "") - set(fast_vapi_stamp "") - foreach(fast_vapi_file ${fast_vapi_files}) - if(NOT "${fast_vapi_file}" STREQUAL "${my_fast_vapi_file}") - list(APPEND fast_vapi_flags --use-fast-vapi "${fast_vapi_file}") - list(APPEND fast_vapi_stamp "${fast_vapi_file}") - endif() - endforeach(fast_vapi_file) - - _vala_mkdir_for_file("${fast_vapi_file}") - get_filename_component(dir "${c_code_file}" DIRECTORY) - - add_custom_command(OUTPUT ${c_code_file} - COMMAND - ${VALA_EXECUTABLE} - ARGS - "-C" - "-d" ${dir} - ${vala_pkg_opts} - ${vala_define_opts} - ${gresources_args} - ${ARGS_OPTIONS} - ${fast_vapi_flags} - ${in_file} - ${custom_vapi_arguments} - DEPENDS - ${fast_vapi_stamp} - ${in_file} - ${ARGS_CUSTOM_VAPIS} - ${ARGS_GRESOURCES} - COMMENT - "Generating C source ${c_code}" - ) - endforeach(src) - - if(NOT "${out_extra_files}" STREQUAL "") - add_custom_command(OUTPUT ${out_extra_files} - COMMAND - ${VALA_EXECUTABLE} - ARGS - -C -q --disable-warnings + -C ${header_arguments} ${vapi_arguments} "-b" ${CMAKE_CURRENT_SOURCE_DIR} @@ -264,8 +302,8 @@ function(vala_precompile output) ${ARGS_CUSTOM_VAPIS} ${ARGS_GRESOURCES} COMMENT - "Generating VAPI and headers for linking" + "Generating C code for target ${output}" ) - endif() + endif(ARGS_FAST_VAPI) set(${output} ${out_files} PARENT_SCOPE) endfunction(vala_precompile) diff --git a/configure b/configure index e98db6ec..4940f9bd 100755 --- a/configure +++ b/configure @@ -15,27 +15,27 @@ then fi if [ -x "$(which ninja 2>/dev/null)" ]; then - echo "Using Ninja ($(which ninja))" + echo "-- Found Ninja: $(which ninja)" cmake_type="Ninja" exec_bin="ninja" elif [ -x "$(which ninja-build 2>/dev/null)" ]; then - echo "Using Ninja ($(which ninja-build))" + echo "-- Found Ninja: $(which ninja-build)" cmake_type="Ninja" exec_bin="ninja-build" elif [ -x "$(which make 2>/dev/null)" ]; then - echo "Using Make ($(which make))" + echo "-- Found Make: $(which make)" cmake_type="Unix Makefiles" - exec_bin="make" - printf "Using Ninja improves build experience, continue with Make? [y/N] " + exec_bin="make -j4" + echo "-- Using Ninja might improve build experience." cont else - echo "No compatible build system (Ninja, Make) found." + echo "-!- No compatible build system (Ninja, Make) found." exit 4 fi if [ -f ./build ] then - echo "./build file exists. ./configure can't continue" + echo "-!- ./build file exists. ./configure can't continue" exit 2 fi @@ -43,13 +43,13 @@ if [ -d build ] then if [ ! -f "build/.cmake_type" ] then - printf "./build exists but was not created by ./configure script, continue? [y/N] " + printf "-!- ./build exists but was not created by ./configure script, continue? [y/N] " cont fi last_type=`cat build/.cmake_type` if [ "$cmake_type" != "$last_type" ] then - echo "Using different build system, cleaning build system files" + echo "-- Using different build system, cleaning build system files" cd build rm -r CMakeCache.txt CMakeFiles cd .. diff --git a/gpgme-vala/CMakeLists.txt b/gpgme-vala/CMakeLists.txt index 322b4e37..519b4ce7 100644 --- a/gpgme-vala/CMakeLists.txt +++ b/gpgme-vala/CMakeLists.txt @@ -28,7 +28,7 @@ OPTIONS --thread ) -set(CFLAGS ${GPGME_VALA_CFLAGS} ${GPGME_CFLAGS} -g ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src) +set(CFLAGS ${VALA_CFLAGS} ${GPGME_VALA_CFLAGS} ${GPGME_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src) add_definitions(${CFLAGS}) add_library(gpgme-vala SHARED ${GPGME_VALA_C} src/fix.c) target_link_libraries(gpgme-vala ${GPGME_VALA_LIBRARIES} ${GPGME_LIBRARIES}) diff --git a/client/CMakeLists.txt b/libdino/CMakeLists.txt similarity index 81% rename from client/CMakeLists.txt rename to libdino/CMakeLists.txt index b86d63a5..faee24e5 100644 --- a/client/CMakeLists.txt +++ b/libdino/CMakeLists.txt @@ -1,20 +1,19 @@ find_package(Vala REQUIRED) find_package(PkgConfig REQUIRED) -find_package(GPGME REQUIRED) -find_package(LIBUUID REQUIRED) include(${VALA_USE_FILE}) include(GlibCompileResourcesSupport) -set(CLIENT_PACKAGES +set(LIBDINO_PACKAGES gee-0.8 gio-2.0 glib-2.0 gtk+-3.0 + gmodule-2.0 libnotify sqlite3 ) -pkg_check_modules(CLIENT REQUIRED ${CLIENT_PACKAGES}) +pkg_check_modules(LIBDINO REQUIRED ${LIBDINO_PACKAGES}) set(RESOURCE_LIST img/double_tick.svg @@ -52,8 +51,8 @@ set(RESOURCE_LIST ) compile_gresources( - CLIENT_GRESOURCES_TARGET - CLIENT_GRESOURCES_XML + LIBDINO_GRESOURCES_TARGET + LIBDINO_GRESOURCES_XML TARGET ${CMAKE_BINARY_DIR}/resources/resources.c TYPE EMBED_C RESOURCES ${RESOURCE_LIST} @@ -61,9 +60,9 @@ compile_gresources( SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data ) -vala_precompile(CLIENT_VALA_C +vala_precompile(LIBDINO_VALA_C SOURCES - src/main.vala + src/plugin.vala src/dbus/login1.vala src/dbus/networkmanager.vala @@ -124,25 +123,31 @@ SOURCES src/ui/settings_dialog.vala src/ui/unified_window.vala src/ui/util.vala +CUSTOM_VAPIS + ${CMAKE_BINARY_DIR}/xmpp-vala/xmpp-vala.vapi + ${CMAKE_BINARY_DIR}/qlite/qlite.vapi PACKAGES - ${CLIENT_PACKAGES} - xmpp-vala - qlite + ${LIBDINO_PACKAGES} +GENERATE_VAPI + dino +GENERATE_HEADER + dino GRESOURCES - ${CLIENT_GRESOURCES_XML} + ${LIBDINO_GRESOURCES_XML} OPTIONS --target-glib=2.38 -g --thread - --vapidir=${CMAKE_BINARY_DIR}/xmpp-vala - --vapidir=${CMAKE_BINARY_DIR}/qlite - --vapidir=${CMAKE_SOURCE_DIR}/vapi - ) -set(CFLAGS ${CLIENT_CFLAGS} -g -I${CMAKE_BINARY_DIR}/xmpp-vala -I${CMAKE_BINARY_DIR}/qlite ${VALA_CFLAGS}) +set(CFLAGS ${VALA_CFLAGS} ${LIBDINO_CFLAGS} -I${CMAKE_BINARY_DIR}/xmpp-vala -I${CMAKE_BINARY_DIR}/qlite) add_definitions(${CFLAGS}) -add_executable(dino ${CLIENT_VALA_C} ${CLIENT_GRESOURCES_TARGET}) -add_dependencies(dino xmpp-vala-vapi qlite-vapi) -target_link_libraries(dino xmpp-vala qlite ${CLIENT_LIBRARIES} -lm) +add_library(libdino SHARED ${LIBDINO_VALA_C} ${LIBDINO_GRESOURCES_TARGET}) +add_dependencies(libdino xmpp-vala-vapi qlite-vapi) +target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_LIBRARIES} -lm) +set_target_properties(libdino PROPERTIES PREFIX "") +add_custom_target(dino-vapi +DEPENDS + ${CMAKE_BINARY_DIR}/libdino/dino.vapi +) diff --git a/client/data/add_conversation/add_contact_dialog.ui b/libdino/data/add_conversation/add_contact_dialog.ui similarity index 100% rename from client/data/add_conversation/add_contact_dialog.ui rename to libdino/data/add_conversation/add_contact_dialog.ui diff --git a/client/data/add_conversation/add_groupchat_dialog.ui b/libdino/data/add_conversation/add_groupchat_dialog.ui similarity index 100% rename from client/data/add_conversation/add_groupchat_dialog.ui rename to libdino/data/add_conversation/add_groupchat_dialog.ui diff --git a/client/data/add_conversation/conference_details_fragment.ui b/libdino/data/add_conversation/conference_details_fragment.ui similarity index 100% rename from client/data/add_conversation/conference_details_fragment.ui rename to libdino/data/add_conversation/conference_details_fragment.ui diff --git a/client/data/add_conversation/list_row.ui b/libdino/data/add_conversation/list_row.ui similarity index 100% rename from client/data/add_conversation/list_row.ui rename to libdino/data/add_conversation/list_row.ui diff --git a/client/data/add_conversation/select_jid_fragment.ui b/libdino/data/add_conversation/select_jid_fragment.ui similarity index 100% rename from client/data/add_conversation/select_jid_fragment.ui rename to libdino/data/add_conversation/select_jid_fragment.ui diff --git a/client/data/chat_input.ui b/libdino/data/chat_input.ui similarity index 100% rename from client/data/chat_input.ui rename to libdino/data/chat_input.ui diff --git a/client/data/conversation_list_titlebar.ui b/libdino/data/conversation_list_titlebar.ui similarity index 100% rename from client/data/conversation_list_titlebar.ui rename to libdino/data/conversation_list_titlebar.ui diff --git a/client/data/conversation_selector/chat_row_tooltip.ui b/libdino/data/conversation_selector/chat_row_tooltip.ui similarity index 100% rename from client/data/conversation_selector/chat_row_tooltip.ui rename to libdino/data/conversation_selector/chat_row_tooltip.ui diff --git a/client/data/conversation_selector/conversation_row.ui b/libdino/data/conversation_selector/conversation_row.ui similarity index 100% rename from client/data/conversation_selector/conversation_row.ui rename to libdino/data/conversation_selector/conversation_row.ui diff --git a/client/data/conversation_selector/view.ui b/libdino/data/conversation_selector/view.ui similarity index 100% rename from client/data/conversation_selector/view.ui rename to libdino/data/conversation_selector/view.ui diff --git a/client/data/conversation_summary/message_item.ui b/libdino/data/conversation_summary/message_item.ui similarity index 100% rename from client/data/conversation_summary/message_item.ui rename to libdino/data/conversation_summary/message_item.ui diff --git a/client/data/conversation_summary/view.ui b/libdino/data/conversation_summary/view.ui similarity index 100% rename from client/data/conversation_summary/view.ui rename to libdino/data/conversation_summary/view.ui diff --git a/client/data/conversation_titlebar.ui b/libdino/data/conversation_titlebar.ui similarity index 100% rename from client/data/conversation_titlebar.ui rename to libdino/data/conversation_titlebar.ui diff --git a/client/data/gschemas.compiled b/libdino/data/gschemas.compiled similarity index 100% rename from client/data/gschemas.compiled rename to libdino/data/gschemas.compiled diff --git a/client/data/img/double_tick.svg b/libdino/data/img/double_tick.svg similarity index 100% rename from client/data/img/double_tick.svg rename to libdino/data/img/double_tick.svg diff --git a/client/data/img/send.svg b/libdino/data/img/send.svg similarity index 100% rename from client/data/img/send.svg rename to libdino/data/img/send.svg diff --git a/client/data/img/status_away.svg b/libdino/data/img/status_away.svg similarity index 100% rename from client/data/img/status_away.svg rename to libdino/data/img/status_away.svg diff --git a/client/data/img/status_chat.svg b/libdino/data/img/status_chat.svg similarity index 100% rename from client/data/img/status_chat.svg rename to libdino/data/img/status_chat.svg diff --git a/client/data/img/status_dnd.svg b/libdino/data/img/status_dnd.svg similarity index 100% rename from client/data/img/status_dnd.svg rename to libdino/data/img/status_dnd.svg diff --git a/client/data/img/status_online.svg b/libdino/data/img/status_online.svg similarity index 100% rename from client/data/img/status_online.svg rename to libdino/data/img/status_online.svg diff --git a/client/data/img/tick.svg b/libdino/data/img/tick.svg similarity index 100% rename from client/data/img/tick.svg rename to libdino/data/img/tick.svg diff --git a/client/data/manage_accounts/account_row.ui b/libdino/data/manage_accounts/account_row.ui similarity index 100% rename from client/data/manage_accounts/account_row.ui rename to libdino/data/manage_accounts/account_row.ui diff --git a/client/data/manage_accounts/add_account_dialog.ui b/libdino/data/manage_accounts/add_account_dialog.ui similarity index 100% rename from client/data/manage_accounts/add_account_dialog.ui rename to libdino/data/manage_accounts/add_account_dialog.ui diff --git a/client/data/manage_accounts/dialog.ui b/libdino/data/manage_accounts/dialog.ui similarity index 100% rename from client/data/manage_accounts/dialog.ui rename to libdino/data/manage_accounts/dialog.ui diff --git a/client/data/menu_add.ui b/libdino/data/menu_add.ui similarity index 100% rename from client/data/menu_add.ui rename to libdino/data/menu_add.ui diff --git a/client/data/menu_app.ui b/libdino/data/menu_app.ui similarity index 100% rename from client/data/menu_app.ui rename to libdino/data/menu_app.ui diff --git a/client/data/menu_conversation.ui b/libdino/data/menu_conversation.ui similarity index 100% rename from client/data/menu_conversation.ui rename to libdino/data/menu_conversation.ui diff --git a/client/data/menu_encryption.ui b/libdino/data/menu_encryption.ui similarity index 100% rename from client/data/menu_encryption.ui rename to libdino/data/menu_encryption.ui diff --git a/client/data/occupant_list.ui b/libdino/data/occupant_list.ui similarity index 100% rename from client/data/occupant_list.ui rename to libdino/data/occupant_list.ui diff --git a/client/data/occupant_list_item.ui b/libdino/data/occupant_list_item.ui similarity index 100% rename from client/data/occupant_list_item.ui rename to libdino/data/occupant_list_item.ui diff --git a/client/data/settings.gschema.xml b/libdino/data/settings.gschema.xml similarity index 100% rename from client/data/settings.gschema.xml rename to libdino/data/settings.gschema.xml diff --git a/client/data/settings_dialog.ui b/libdino/data/settings_dialog.ui similarity index 100% rename from client/data/settings_dialog.ui rename to libdino/data/settings_dialog.ui diff --git a/client/data/style.css b/libdino/data/style.css similarity index 100% rename from client/data/style.css rename to libdino/data/style.css diff --git a/client/data/unified_window.ui b/libdino/data/unified_window.ui similarity index 100% rename from client/data/unified_window.ui rename to libdino/data/unified_window.ui diff --git a/client/src/dbus/login1.vala b/libdino/src/dbus/login1.vala similarity index 100% rename from client/src/dbus/login1.vala rename to libdino/src/dbus/login1.vala diff --git a/client/src/dbus/networkmanager.vala b/libdino/src/dbus/networkmanager.vala similarity index 100% rename from client/src/dbus/networkmanager.vala rename to libdino/src/dbus/networkmanager.vala diff --git a/client/src/dbus/upower.vala b/libdino/src/dbus/upower.vala similarity index 100% rename from client/src/dbus/upower.vala rename to libdino/src/dbus/upower.vala diff --git a/client/src/entity/account.vala b/libdino/src/entity/account.vala similarity index 100% rename from client/src/entity/account.vala rename to libdino/src/entity/account.vala diff --git a/client/src/entity/conversation.vala b/libdino/src/entity/conversation.vala similarity index 100% rename from client/src/entity/conversation.vala rename to libdino/src/entity/conversation.vala diff --git a/client/src/entity/jid.vala b/libdino/src/entity/jid.vala similarity index 100% rename from client/src/entity/jid.vala rename to libdino/src/entity/jid.vala diff --git a/client/src/entity/message.vala b/libdino/src/entity/message.vala similarity index 100% rename from client/src/entity/message.vala rename to libdino/src/entity/message.vala diff --git a/libdino/src/plugin.vala b/libdino/src/plugin.vala new file mode 100644 index 00000000..60a99bc2 --- /dev/null +++ b/libdino/src/plugin.vala @@ -0,0 +1,64 @@ +namespace Dino { + +public errordomain PluginError { + NOT_SUPPORTED, + UNEXPECTED_TYPE, + NO_REGISTRATION_FUNCTION, + FAILED +} + +public interface PluginIface : Object { + public abstract void registered(Dino.Ui.Application app); +} + +private class PluginInfo : Object { + public Module module; + public Type gtype; + + public PluginInfo(Type type, owned Module module) { + this.module = (owned) module; + this.gtype = type; + } +} + +public class PluginLoader : Object { + [CCode (has_target = false)] + private delegate Type RegisterPluginFunction (Module module); + + private PluginIface[] plugins = new PluginIface[0]; + private PluginInfo[] infos = new PluginInfo[0]; + + public PluginIface load(string name, Dino.Ui.Application app) throws PluginError { + if (Module.supported () == false) { + throw new PluginError.NOT_SUPPORTED ("Plugins are not supported"); + } + + Module module = Module.open ("plugins/" + name, ModuleFlags.BIND_LAZY); + if (module == null) { + throw new PluginError.FAILED (Module.error ()); + } + + void* function; + module.symbol ("register_plugin", out function); + if (function == null) { + throw new PluginError.NO_REGISTRATION_FUNCTION ("register_plugin () not found"); + } + + RegisterPluginFunction register_plugin = (RegisterPluginFunction) function; + Type type = register_plugin (module); + if (type.is_a (typeof (PluginIface)) == false) { + throw new PluginError.UNEXPECTED_TYPE ("Unexpected type"); + } + + PluginInfo info = new PluginInfo (type, (owned) module); + infos += info; + + PluginIface plugin = (PluginIface) Object.new (type); + plugins += plugin; + plugin.registered (app); + + return plugin; + } +} + +} \ No newline at end of file diff --git a/client/src/service/avatar_manager.vala b/libdino/src/service/avatar_manager.vala similarity index 100% rename from client/src/service/avatar_manager.vala rename to libdino/src/service/avatar_manager.vala diff --git a/client/src/service/avatar_storage.vala b/libdino/src/service/avatar_storage.vala similarity index 100% rename from client/src/service/avatar_storage.vala rename to libdino/src/service/avatar_storage.vala diff --git a/client/src/service/chat_interaction.vala b/libdino/src/service/chat_interaction.vala similarity index 100% rename from client/src/service/chat_interaction.vala rename to libdino/src/service/chat_interaction.vala diff --git a/client/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala similarity index 100% rename from client/src/service/connection_manager.vala rename to libdino/src/service/connection_manager.vala diff --git a/client/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala similarity index 100% rename from client/src/service/conversation_manager.vala rename to libdino/src/service/conversation_manager.vala diff --git a/client/src/service/counterpart_interaction_manager.vala b/libdino/src/service/counterpart_interaction_manager.vala similarity index 100% rename from client/src/service/counterpart_interaction_manager.vala rename to libdino/src/service/counterpart_interaction_manager.vala diff --git a/client/src/service/database.vala b/libdino/src/service/database.vala similarity index 100% rename from client/src/service/database.vala rename to libdino/src/service/database.vala diff --git a/client/src/service/entity_capabilities_storage.vala b/libdino/src/service/entity_capabilities_storage.vala similarity index 100% rename from client/src/service/entity_capabilities_storage.vala rename to libdino/src/service/entity_capabilities_storage.vala diff --git a/client/src/service/message_manager.vala b/libdino/src/service/message_manager.vala similarity index 100% rename from client/src/service/message_manager.vala rename to libdino/src/service/message_manager.vala diff --git a/client/src/service/module_manager.vala b/libdino/src/service/module_manager.vala similarity index 100% rename from client/src/service/module_manager.vala rename to libdino/src/service/module_manager.vala diff --git a/client/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala similarity index 100% rename from client/src/service/muc_manager.vala rename to libdino/src/service/muc_manager.vala diff --git a/client/src/service/pgp_manager.vala b/libdino/src/service/pgp_manager.vala similarity index 100% rename from client/src/service/pgp_manager.vala rename to libdino/src/service/pgp_manager.vala diff --git a/client/src/service/presence_manager.vala b/libdino/src/service/presence_manager.vala similarity index 100% rename from client/src/service/presence_manager.vala rename to libdino/src/service/presence_manager.vala diff --git a/client/src/service/roster_manager.vala b/libdino/src/service/roster_manager.vala similarity index 100% rename from client/src/service/roster_manager.vala rename to libdino/src/service/roster_manager.vala diff --git a/client/src/service/stream_interactor.vala b/libdino/src/service/stream_interactor.vala similarity index 100% rename from client/src/service/stream_interactor.vala rename to libdino/src/service/stream_interactor.vala diff --git a/client/src/settings.vala b/libdino/src/settings.vala similarity index 100% rename from client/src/settings.vala rename to libdino/src/settings.vala diff --git a/client/src/ui/add_conversation/chat/add_contact_dialog.vala b/libdino/src/ui/add_conversation/chat/add_contact_dialog.vala similarity index 100% rename from client/src/ui/add_conversation/chat/add_contact_dialog.vala rename to libdino/src/ui/add_conversation/chat/add_contact_dialog.vala diff --git a/client/src/ui/add_conversation/chat/dialog.vala b/libdino/src/ui/add_conversation/chat/dialog.vala similarity index 100% rename from client/src/ui/add_conversation/chat/dialog.vala rename to libdino/src/ui/add_conversation/chat/dialog.vala diff --git a/client/src/ui/add_conversation/chat/roster_list.vala b/libdino/src/ui/add_conversation/chat/roster_list.vala similarity index 100% rename from client/src/ui/add_conversation/chat/roster_list.vala rename to libdino/src/ui/add_conversation/chat/roster_list.vala diff --git a/client/src/ui/add_conversation/conference/add_groupchat_dialog.vala b/libdino/src/ui/add_conversation/conference/add_groupchat_dialog.vala similarity index 100% rename from client/src/ui/add_conversation/conference/add_groupchat_dialog.vala rename to libdino/src/ui/add_conversation/conference/add_groupchat_dialog.vala diff --git a/client/src/ui/add_conversation/conference/conference_details_fragment.vala b/libdino/src/ui/add_conversation/conference/conference_details_fragment.vala similarity index 100% rename from client/src/ui/add_conversation/conference/conference_details_fragment.vala rename to libdino/src/ui/add_conversation/conference/conference_details_fragment.vala diff --git a/client/src/ui/add_conversation/conference/conference_list.vala b/libdino/src/ui/add_conversation/conference/conference_list.vala similarity index 100% rename from client/src/ui/add_conversation/conference/conference_list.vala rename to libdino/src/ui/add_conversation/conference/conference_list.vala diff --git a/client/src/ui/add_conversation/conference/dialog.vala b/libdino/src/ui/add_conversation/conference/dialog.vala similarity index 100% rename from client/src/ui/add_conversation/conference/dialog.vala rename to libdino/src/ui/add_conversation/conference/dialog.vala diff --git a/client/src/ui/add_conversation/list_row.vala b/libdino/src/ui/add_conversation/list_row.vala similarity index 100% rename from client/src/ui/add_conversation/list_row.vala rename to libdino/src/ui/add_conversation/list_row.vala diff --git a/client/src/ui/add_conversation/select_jid_fragment.vala b/libdino/src/ui/add_conversation/select_jid_fragment.vala similarity index 100% rename from client/src/ui/add_conversation/select_jid_fragment.vala rename to libdino/src/ui/add_conversation/select_jid_fragment.vala diff --git a/client/src/ui/application.vala b/libdino/src/ui/application.vala similarity index 99% rename from client/src/ui/application.vala rename to libdino/src/ui/application.vala index c3f0e302..0878e50d 100644 --- a/client/src/ui/application.vala +++ b/libdino/src/ui/application.vala @@ -28,6 +28,7 @@ public class Dino.Ui.Application : Gtk.Application { ConversationManager.start(stream_interaction, db); ChatInteraction.start(stream_interaction); + Notify.init("dino"); notifications = new Notifications(stream_interaction); notifications.start(); diff --git a/client/src/ui/avatar_generator.vala b/libdino/src/ui/avatar_generator.vala similarity index 100% rename from client/src/ui/avatar_generator.vala rename to libdino/src/ui/avatar_generator.vala diff --git a/client/src/ui/chat_input.vala b/libdino/src/ui/chat_input.vala similarity index 100% rename from client/src/ui/chat_input.vala rename to libdino/src/ui/chat_input.vala diff --git a/client/src/ui/conversation_list_titlebar.vala b/libdino/src/ui/conversation_list_titlebar.vala similarity index 100% rename from client/src/ui/conversation_list_titlebar.vala rename to libdino/src/ui/conversation_list_titlebar.vala diff --git a/client/src/ui/conversation_selector/chat_row.vala b/libdino/src/ui/conversation_selector/chat_row.vala similarity index 100% rename from client/src/ui/conversation_selector/chat_row.vala rename to libdino/src/ui/conversation_selector/chat_row.vala diff --git a/client/src/ui/conversation_selector/conversation_row.vala b/libdino/src/ui/conversation_selector/conversation_row.vala similarity index 100% rename from client/src/ui/conversation_selector/conversation_row.vala rename to libdino/src/ui/conversation_selector/conversation_row.vala diff --git a/client/src/ui/conversation_selector/groupchat_row.vala b/libdino/src/ui/conversation_selector/groupchat_row.vala similarity index 100% rename from client/src/ui/conversation_selector/groupchat_row.vala rename to libdino/src/ui/conversation_selector/groupchat_row.vala diff --git a/client/src/ui/conversation_selector/list.vala b/libdino/src/ui/conversation_selector/list.vala similarity index 100% rename from client/src/ui/conversation_selector/list.vala rename to libdino/src/ui/conversation_selector/list.vala diff --git a/client/src/ui/conversation_selector/view.vala b/libdino/src/ui/conversation_selector/view.vala similarity index 100% rename from client/src/ui/conversation_selector/view.vala rename to libdino/src/ui/conversation_selector/view.vala diff --git a/client/src/ui/conversation_summary/merged_message_item.vala b/libdino/src/ui/conversation_summary/merged_message_item.vala similarity index 100% rename from client/src/ui/conversation_summary/merged_message_item.vala rename to libdino/src/ui/conversation_summary/merged_message_item.vala diff --git a/client/src/ui/conversation_summary/merged_status_item.vala b/libdino/src/ui/conversation_summary/merged_status_item.vala similarity index 100% rename from client/src/ui/conversation_summary/merged_status_item.vala rename to libdino/src/ui/conversation_summary/merged_status_item.vala diff --git a/client/src/ui/conversation_summary/status_item.vala b/libdino/src/ui/conversation_summary/status_item.vala similarity index 100% rename from client/src/ui/conversation_summary/status_item.vala rename to libdino/src/ui/conversation_summary/status_item.vala diff --git a/client/src/ui/conversation_summary/view.vala b/libdino/src/ui/conversation_summary/view.vala similarity index 100% rename from client/src/ui/conversation_summary/view.vala rename to libdino/src/ui/conversation_summary/view.vala diff --git a/client/src/ui/conversation_titlebar.vala b/libdino/src/ui/conversation_titlebar.vala similarity index 100% rename from client/src/ui/conversation_titlebar.vala rename to libdino/src/ui/conversation_titlebar.vala diff --git a/client/src/ui/manage_accounts/account_row.vala b/libdino/src/ui/manage_accounts/account_row.vala similarity index 100% rename from client/src/ui/manage_accounts/account_row.vala rename to libdino/src/ui/manage_accounts/account_row.vala diff --git a/client/src/ui/manage_accounts/add_account_dialog.vala b/libdino/src/ui/manage_accounts/add_account_dialog.vala similarity index 100% rename from client/src/ui/manage_accounts/add_account_dialog.vala rename to libdino/src/ui/manage_accounts/add_account_dialog.vala diff --git a/client/src/ui/manage_accounts/dialog.vala b/libdino/src/ui/manage_accounts/dialog.vala similarity index 100% rename from client/src/ui/manage_accounts/dialog.vala rename to libdino/src/ui/manage_accounts/dialog.vala diff --git a/client/src/ui/notifications.vala b/libdino/src/ui/notifications.vala similarity index 100% rename from client/src/ui/notifications.vala rename to libdino/src/ui/notifications.vala diff --git a/client/src/ui/occupant_list.vala b/libdino/src/ui/occupant_list.vala similarity index 100% rename from client/src/ui/occupant_list.vala rename to libdino/src/ui/occupant_list.vala diff --git a/client/src/ui/occupant_list_row.vala b/libdino/src/ui/occupant_list_row.vala similarity index 100% rename from client/src/ui/occupant_list_row.vala rename to libdino/src/ui/occupant_list_row.vala diff --git a/client/src/ui/settings_dialog.vala b/libdino/src/ui/settings_dialog.vala similarity index 100% rename from client/src/ui/settings_dialog.vala rename to libdino/src/ui/settings_dialog.vala diff --git a/client/src/ui/unified_window.vala b/libdino/src/ui/unified_window.vala similarity index 100% rename from client/src/ui/unified_window.vala rename to libdino/src/ui/unified_window.vala diff --git a/client/src/ui/util.vala b/libdino/src/ui/util.vala similarity index 100% rename from client/src/ui/util.vala rename to libdino/src/ui/util.vala diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt new file mode 100644 index 00000000..cfb14eed --- /dev/null +++ b/main/CMakeLists.txt @@ -0,0 +1,35 @@ +find_package(Vala REQUIRED) +find_package(PkgConfig REQUIRED) +include(${VALA_USE_FILE}) + +set(MAIN_PACKAGES + gee-0.8 + gio-2.0 + glib-2.0 + gtk+-3.0 + gmodule-2.0 + sqlite3 +) + +pkg_check_modules(MAIN REQUIRED ${MAIN_PACKAGES}) + +vala_precompile(MAIN_VALA_C +SOURCES + src/main.vala +CUSTOM_VAPIS + ${CMAKE_BINARY_DIR}/xmpp-vala/xmpp-vala.vapi + ${CMAKE_BINARY_DIR}/qlite/qlite.vapi + ${CMAKE_BINARY_DIR}/libdino/dino.vapi +PACKAGES + ${MAIN_PACKAGES} +OPTIONS + --target-glib=2.38 + -g + --thread +) + +set(CFLAGS ${VALA_CFLAGS} ${MAIN_CFLAGS} -I${CMAKE_BINARY_DIR}/xmpp-vala -I${CMAKE_BINARY_DIR}/qlite -I${CMAKE_BINARY_DIR}/libdino) +add_definitions(${CFLAGS}) +add_executable(dino ${MAIN_VALA_C}) +add_dependencies(dino dino-vapi) +target_link_libraries(dino libdino) \ No newline at end of file diff --git a/main/src/main.vala b/main/src/main.vala new file mode 100644 index 00000000..80f9bea5 --- /dev/null +++ b/main/src/main.vala @@ -0,0 +1,20 @@ +using Dino.Entities; +using Dino.Ui; + +namespace Dino { + +void main(string[] args) { + Gtk.init(ref args); + Dino.Ui.Application app = new Dino.Ui.Application(); + PluginLoader loader = new PluginLoader(); + foreach(string plugin in new string[]{}) { + try { + loader.load(plugin, app); + } catch (Dino.PluginError e) { + print(@"Error loading plugin $plugin: $(e.message)\n"); + } + } + app.run(args); +} + +} \ No newline at end of file diff --git a/qlite/CMakeLists.txt b/qlite/CMakeLists.txt index d19ed2d2..70ac249f 100644 --- a/qlite/CMakeLists.txt +++ b/qlite/CMakeLists.txt @@ -34,7 +34,7 @@ OPTIONS --vapidir=${CMAKE_SOURCE_DIR}/vapi ) -set(CFLAGS ${QLITE_CFLAGS} -g ${VALA_CFLAGS}) +set(CFLAGS ${VALA_CFLAGS} ${QLITE_CFLAGS}) add_definitions(${CFLAGS}) add_library(qlite SHARED ${QLITE_VALA_C}) target_link_libraries(qlite ${QLITE_LIBRARIES}) diff --git a/xmpp-vala/CMakeLists.txt b/xmpp-vala/CMakeLists.txt index 95c9c44b..a0e91841 100644 --- a/xmpp-vala/CMakeLists.txt +++ b/xmpp-vala/CMakeLists.txt @@ -9,7 +9,7 @@ set(ENGINE_PACKAGES gee-0.8 gio-2.0 glib-2.0 - gtk+-3.0 + gdk-3.0 ) pkg_check_modules(ENGINE REQUIRED ${ENGINE_PACKAGES}) @@ -80,10 +80,10 @@ OPTIONS --vapidir=${CMAKE_SOURCE_DIR}/vapi ) -set(CFLAGS ${ENGINE_CFLAGS} ${GPGME_CFLAGS} ${LIBUUID_CFLAGS} -g ${VALA_CFLAGS} -I${CMAKE_BINARY_DIR}/gpgme-vala) +set(CFLAGS ${VALA_CFLAGS} ${ENGINE_CFLAGS} ${GPGME_CFLAGS} ${LIBUUID_CFLAGS} -I${CMAKE_BINARY_DIR}/gpgme-vala) add_definitions(${CFLAGS}) add_library(xmpp-vala SHARED ${ENGINE_VALA_C}) -add_dependencies(xmpp-vala gpgme-vala gpgme-vapi) +add_dependencies(xmpp-vala gpgme-vapi) target_link_libraries(xmpp-vala gpgme-vala ${ENGINE_LIBRARIES} ${GPGME_LIBRARIES} ${LIBUUID_LIBRARIES}) add_custom_target(xmpp-vala-vapi diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala index 5f92113d..2cba2b54 100644 --- a/xmpp-vala/src/core/xmpp_stream.vala +++ b/xmpp-vala/src/core/xmpp_stream.vala @@ -93,7 +93,7 @@ public class XmppStream { } } - public IOStream get_stream() { + public IOStream? get_stream() { return stream; }