mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-21 16:38:06 -06:00
[price-quotes] Enable gnucash-cli to retrieve preferences on macOS.
By embedding a minimal Info.plist with a bundle ID into the executable. This necessitated a change to binreloc because the unix-style install depended on there being a bundle ID only when the program was run from an application bundle.
This commit is contained in:
parent
2767587874
commit
1a906b00aa
8
Info.plist
Normal file
8
Info.plist
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>org.gnucash.Gnucash</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -152,6 +152,7 @@ if (MAC_INTEGRATION)
|
|||||||
target_link_libraries(gnucash ${OSX_EXTRA_LIBRARIES})
|
target_link_libraries(gnucash ${OSX_EXTRA_LIBRARIES})
|
||||||
target_compile_options(gnucash-cli PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
|
target_compile_options(gnucash-cli PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
|
||||||
target_link_libraries(gnucash-cli ${OSX_EXTRA_LIBRARIES})
|
target_link_libraries(gnucash-cli ${OSX_EXTRA_LIBRARIES})
|
||||||
|
target_link_options(gnucash-cli PRIVATE -Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_SOURCE_DIR}/Info.plist)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS gnucash gnucash-cli DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS gnucash gnucash-cli DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
@ -365,6 +365,7 @@ Gnucash::add_quotes (const bo_str& uri)
|
|||||||
int
|
int
|
||||||
Gnucash::report_quotes (const char* source, const StrVec& commodities, bool verbose)
|
Gnucash::report_quotes (const char* source, const StrVec& commodities, bool verbose)
|
||||||
{
|
{
|
||||||
|
gnc_prefs_init();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GncQuotes quotes;
|
GncQuotes quotes;
|
||||||
|
@ -173,7 +173,7 @@ m_version{}, m_sources{}, m_api_key{}
|
|||||||
m_sources = std::move(sources);
|
m_sources = std::move(sources);
|
||||||
|
|
||||||
auto av_key = gnc_prefs_get_string ("general.finance-quote", "alphavantage-api-key");
|
auto av_key = gnc_prefs_get_string ("general.finance-quote", "alphavantage-api-key");
|
||||||
if (!av_key)
|
if (!(av_key && *av_key))
|
||||||
av_key = getenv("ALPHAVANTAGE_API_KEY");
|
av_key = getenv("ALPHAVANTAGE_API_KEY");
|
||||||
|
|
||||||
if (av_key)
|
if (av_key)
|
||||||
|
@ -369,6 +369,7 @@ get_mac_bundle_prefix()
|
|||||||
#if defined ENABLE_BINRELOC && defined MAC_INTEGRATION
|
#if defined ENABLE_BINRELOC && defined MAC_INTEGRATION
|
||||||
gchar *id = gtkosx_application_get_bundle_id ();
|
gchar *id = gtkosx_application_get_bundle_id ();
|
||||||
gchar *path = gtkosx_application_get_resource_path ();
|
gchar *path = gtkosx_application_get_resource_path ();
|
||||||
|
gchar *basename = g_path_get_basename (path);
|
||||||
/* If id is nullthe app is unbundled and the path
|
/* If id is nullthe app is unbundled and the path
|
||||||
is just the path to the application directory.
|
is just the path to the application directory.
|
||||||
We already have that and our version is better.
|
We already have that and our version is better.
|
||||||
@ -377,11 +378,23 @@ get_mac_bundle_prefix()
|
|||||||
*/
|
*/
|
||||||
if (id == NULL || g_getenv ("GNC_UNINSTALLED"))
|
if (id == NULL || g_getenv ("GNC_UNINSTALLED"))
|
||||||
{
|
{
|
||||||
|
g_free (basename);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
g_free (id);
|
g_free (id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (id);
|
g_free (id);
|
||||||
|
|
||||||
|
if (g_strcmp0 ("bin", basename) == 0)
|
||||||
|
{
|
||||||
|
g_free (path);
|
||||||
|
g_free (basename);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (basename);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user