diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b117f00..8a984fd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,9 @@ endif () # Prepare Plugins set(DEFAULT_PLUGINS omemo;openpgp;http-files;ice;rtp) +if (WIN32) + set(DEFAULT_PLUGINS ${DEFAULT_PLUGINS};win32-fonts) +endif (WIN32) foreach (plugin ${DEFAULT_PLUGINS}) if ("$CACHE{DINO_PLUGIN_ENABLED_${plugin}}" STREQUAL "") if (NOT DEFINED DINO_PLUGIN_ENABLED_${plugin}}) diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 3027efd7..c9e2e6a0 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -87,7 +87,6 @@ set(RESOURCE_LIST unified_main_content.ui unified_window_placeholder.ui - win32_larger_fonts.css theme.css ) diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 6d4f74ff..780c37fd 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -27,12 +27,6 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { Environment.set_application_name("Dino"); Window.set_default_icon_name("im.dino.Dino"); -#if _WIN32 - CssProvider larger_fonts = new CssProvider(); - larger_fonts.load_from_resource("/im/dino/Dino/win32_larger_fonts.css"); - StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), larger_fonts, STYLE_PROVIDER_PRIORITY_APPLICATION); -#endif - CssProvider provider = new CssProvider(); provider.load_from_resource("/im/dino/Dino/theme.css"); StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, STYLE_PROVIDER_PRIORITY_APPLICATION); diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 8ff9e16f..b3137946 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -23,3 +23,7 @@ endif(DINO_PLUGIN_ENABLED_omemo) if(DINO_PLUGIN_ENABLED_notification-sound) add_subdirectory(notification-sound) endif(DINO_PLUGIN_ENABLED_notification-sound) + +if(DINO_PLUGIN_ENABLED_win32-fonts) + add_subdirectory(win32-fonts) +endif(DINO_PLUGIN_ENABLED_win32-fonts) diff --git a/plugins/win32-fonts/CMakeLists.txt b/plugins/win32-fonts/CMakeLists.txt new file mode 100644 index 00000000..b5a80e52 --- /dev/null +++ b/plugins/win32-fonts/CMakeLists.txt @@ -0,0 +1,43 @@ +find_packages(WIN32_FONTS_PACKAGES REQUIRED + Gee + GLib + GModule + GObject + GTK3 +) + +set(RESOURCE_LIST + larger.css +) + +compile_gresources( + WIN32_FONTS_GRESOURCES_TARGET + WIN32_FONTS_GRESOURCES_XML + TARGET ${CMAKE_CURRENT_BINARY_DIR}/resources/resources.c + TYPE EMBED_C + RESOURCES ${RESOURCE_LIST} + PREFIX /im/dino/Dino/win32-fonts + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data +) + +vala_precompile(WIN32_FONTS_VALA_C +SOURCES + src/plugin.vala + src/register_plugin.vala +CUSTOM_VAPIS + ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi + ${CMAKE_BINARY_DIR}/exports/dino.vapi + ${CMAKE_BINARY_DIR}/exports/qlite.vapi +PACKAGES + ${WIN32_FONTS_PACKAGES} +GRESOURCES + ${WIN32_FONTS_GRESOURCES_XML} +) + +add_definitions(${VALA_CFLAGS}) +add_library(win32-fonts SHARED ${WIN32_FONTS_VALA_C} ${WIN32_FONTS_GRESOURCES_TARGET}) +target_link_libraries(win32-fonts libdino ${WIN32_FONTS_PACKAGES}) +set_target_properties(win32-fonts PROPERTIES PREFIX "") +set_target_properties(win32-fonts PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/) + +install(TARGETS win32-fonts ${PLUGIN_INSTALL}) diff --git a/main/data/win32_larger_fonts.css b/plugins/win32-fonts/data/larger.css similarity index 100% rename from main/data/win32_larger_fonts.css rename to plugins/win32-fonts/data/larger.css diff --git a/plugins/win32-fonts/src/plugin.vala b/plugins/win32-fonts/src/plugin.vala new file mode 100644 index 00000000..1d9d00bd --- /dev/null +++ b/plugins/win32-fonts/src/plugin.vala @@ -0,0 +1,16 @@ +using Gtk; + +namespace Dino.Plugins.Win32Fonts { + +public class Plugin : RootInterface, Object { + + public void registered(Dino.Application app) { + CssProvider larger_fonts = new CssProvider(); + larger_fonts.load_from_resource("/im/dino/Dino/win32-fonts/larger.css"); + StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), larger_fonts, STYLE_PROVIDER_PRIORITY_APPLICATION); + } + + public void shutdown() { } +} + +} diff --git a/plugins/win32-fonts/src/register_plugin.vala b/plugins/win32-fonts/src/register_plugin.vala new file mode 100644 index 00000000..b0bfa375 --- /dev/null +++ b/plugins/win32-fonts/src/register_plugin.vala @@ -0,0 +1,3 @@ +public Type register_plugin(Module module) { + return typeof (Dino.Plugins.Win32Fonts.Plugin); +}