Convert gncmod-gnome-search into an ordinary library

Search initialization happens now in gnucash-bin.c/inner_main. That will also add
a hook to finalize the search library at shutdown.
This commit is contained in:
Geert Janssens
2020-04-24 15:30:57 +02:00
parent debb5468f4
commit 8a764f23e2
6 changed files with 11 additions and 95 deletions

View File

@@ -1,6 +1,5 @@
set (gnome_search_SOURCES
gncmod-gnome-search.c
gnc-general-search.c
dialog-search.c
search-account.c
@@ -40,23 +39,23 @@ set_local_dist(gnome_search_DIST_local CMakeLists.txt ${gnome_search_SOURCES} ${
${gnome_search_noinst_HEADERS})
set(gnome_search_DIST ${gnome_search_DIST_local} PARENT_SCOPE)
add_library (gncmod-gnome-search
add_library (gnc-gnome-search
${gnome_search_SOURCES}
${gnome_search_HEADERS}
${gnome_search_noinst_HEADERS}
)
target_link_libraries(gncmod-gnome-search gnc-gnome-utils PkgConfig::GTK3)
target_link_libraries(gnc-gnome-search gnc-gnome-utils PkgConfig::GTK3)
target_compile_definitions(gncmod-gnome-search PRIVATE -DG_LOG_DOMAIN=\"gnc.gui.search\")
target_compile_definitions(gnc-gnome-search PRIVATE -DG_LOG_DOMAIN=\"gnc.gui.search\")
target_include_directories(gncmod-gnome-search PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(gnc-gnome-search PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if (APPLE)
set_target_properties (gncmod-gnome-search PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
set_target_properties (gnc-gnome-search PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
endif()
install(TARGETS gncmod-gnome-search
install(TARGETS gnc-gnome-search
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@@ -1,84 +0,0 @@
/*********************************************************************
* gncmod-gnome-search
* GNC Module initialization for the Gnome Search UI
*
* Copyright (c) 2002 Derek Atkins <warlord@MIT.EDU>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, contact:
*
* Free Software Foundation Voice: +1-617-542-5942
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*********************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <gmodule.h>
#include "gnc-module.h"
#include "gnc-module-api.h"
#include "search-core-type.h"
GNC_MODULE_API_DECL(libgncmod_gnome_search)
/* version of the gnc module system interface we require */
int libgncmod_gnome_search_gnc_module_system_interface = 0;
/* module versioning uses libtool semantics. */
int libgncmod_gnome_search_gnc_module_current = 0;
int libgncmod_gnome_search_gnc_module_revision = 0;
int libgncmod_gnome_search_gnc_module_age = 0;
char *
libgncmod_gnome_search_gnc_module_path(void)
{
return g_strdup("gnucash/gnome-search");
}
char *
libgncmod_gnome_search_gnc_module_description(void)
{
return g_strdup("The GnuCash Gnome Search UI");
}
int
libgncmod_gnome_search_gnc_module_init(int refcount)
{
if (refcount == 0)
{
/* initialize known types */
gnc_search_core_initialize ();
}
return TRUE;
}
int
libgncmod_gnome_search_gnc_module_end(int refcount)
{
/* XXX Unload the other modules */
if (refcount == 0)
{
/* Shutdown */
gnc_search_core_finalize ();
}
return TRUE;
}

View File

@@ -137,7 +137,7 @@ set_source_files_properties (${gnc_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CO
add_library (gnc-gnome ${gnc_gnome_SOURCES} ${gnc_gnome_noinst_HEADERS} ${SWIG_GNOME_C})
target_link_libraries(gnc-gnome
gncmod-gnome-search
gnc-gnome-search
gnc-ledger-core
gncmod-report
gncmod-register-gnome

View File

@@ -57,6 +57,7 @@
#include "gnc-engine-guile.h"
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "search-core-type.h"
#include "window-report.h"
#ifdef __MINGW32__
#include <Windows.h>
@@ -487,7 +488,6 @@ load_gnucash_modules()
gboolean optional;
} modules[] =
{
{ "gnucash/gnome-search", 0, FALSE },
{ "gnucash/register/register-gnome", 0, FALSE },
{ "gnucash/import-export/qif-import", 0, FALSE },
{ "gnucash/import-export/ofx", 0, TRUE },
@@ -609,6 +609,8 @@ inner_main (void *closure, int argc, char **argv)
gnc_gsettings_version_upgrade ();
gnc_gnome_utils_init();
gnc_search_core_initialize ();
gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_search_core_finalize, NULL, NULL);
load_gnucash_modules();

View File

@@ -20,7 +20,7 @@ add_library(gncmod-bi-import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES})
target_link_libraries(gncmod-bi-import
gnc-gnome-utils
gncmod-gnome-search
gnc-gnome-search
gnc-app-utils
gnc-engine
gnc-core-utils

View File

@@ -92,7 +92,6 @@ gnucash/gnome/window-reconcile.c
gnucash/gnome/window-report.c
gnucash/gnome-search/dialog-search.c
gnucash/gnome-search/gnc-general-search.c
gnucash/gnome-search/gncmod-gnome-search.c
gnucash/gnome-search/search-account.c
gnucash/gnome-search/search-boolean.c
gnucash/gnome-search/search-core-type.c