Add WIN32 fonts as a plugin
This commit is contained in:
parent
6d5ee03e9e
commit
823df3ed70
|
@ -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}})
|
||||
|
|
|
@ -87,7 +87,6 @@ set(RESOURCE_LIST
|
|||
unified_main_content.ui
|
||||
unified_window_placeholder.ui
|
||||
|
||||
win32_larger_fonts.css
|
||||
theme.css
|
||||
)
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
43
plugins/win32-fonts/CMakeLists.txt
Normal file
43
plugins/win32-fonts/CMakeLists.txt
Normal file
|
@ -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})
|
16
plugins/win32-fonts/src/plugin.vala
Normal file
16
plugins/win32-fonts/src/plugin.vala
Normal file
|
@ -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() { }
|
||||
}
|
||||
|
||||
}
|
3
plugins/win32-fonts/src/register_plugin.vala
Normal file
3
plugins/win32-fonts/src/register_plugin.vala
Normal file
|
@ -0,0 +1,3 @@
|
|||
public Type register_plugin(Module module) {
|
||||
return typeof (Dino.Plugins.Win32Fonts.Plugin);
|
||||
}
|
Loading…
Reference in a new issue