Skip to content

Commit 0bc54da

Browse files
committed
Major changes
- xml repo config - git submodules support (i fuck that make) - build optionts add - code style change - not full pull - pulling one dir or file - another small fixes
1 parent bfa5b42 commit 0bc54da

File tree

8 files changed

+505
-225
lines changed

8 files changed

+505
-225
lines changed

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,15 @@ set(conky_sources ${CMAKE_BINARY_DIR}/config.h ${CMAKE_BINARY_DIR}/build.h)
5353
add_subdirectory(3rdparty)
5454
set(conky_libs ${conky_libs} toluapp_lib_static)
5555
set(conky_libs ${conky_libs} Vc)
56-
set(conky_libs ${conky_libs} PkgConfig::LIBGIT2)
5756

5857
set(conky_includes ${conky_includes} "${CMAKE_SOURCE_DIR}/3rdparty/Vc")
5958

6059
# Finally, add some code
6160
add_subdirectory(lua)
6261
add_subdirectory(data)
6362
add_subdirectory(doc)
64-
find_package(PkgConfig REQUIRED)
65-
pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2)
63+
# find_package(PkgConfig REQUIRED)
64+
# pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2)
6665
if(BUILD_EXTRAS)
6766
add_subdirectory(extras)
6867
endif(BUILD_EXTRAS)

cmake/ConkyBuildOptions.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ option(BUILD_PULSEAUDIO
299299
option(BUILD_INTEL_BACKLIGHT
300300
"Enable support for Intel backlight" false)
301301

302+
option(BUILD_PRESETS "Enable theme presets support" true)
303+
304+
set(PRESETS_REPO_URL "https://github.com/Cetttok/testRepoForConkyThemes")
305+
306+
set(PRESETS_REPO_PATH "/var/lib/conky/themes")
307+
302308
run_dependency_checks()
303309

304310
message(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})

cmake/ConkyPlatformChecks.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,14 @@ if(WANT_CURL)
659659
set(conky_includes ${conky_includes} ${CURL_INCLUDE_DIRS})
660660
endif(WANT_CURL)
661661

662+
if(BUILD_PRESETS)
663+
find_package(PkgConfig REQUIRED)
664+
pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2)
665+
set(conky_libs ${conky_libs} PkgConfig::LIBGIT2)
666+
set(WANT_LIBXML2 true)
667+
endif(BUILD_PRESETS)
668+
669+
662670
if(WANT_LIBXML2)
663671
include(FindLibXml2)
664672

@@ -738,3 +746,4 @@ if(DEBUG)
738746
OUTPUT_VARIABLE COMMIT_COUNT
739747
OUTPUT_STRIP_TRAILING_WHITESPACE)
740748
endif(DEBUG)
749+

cmake/config.h.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#define DEFAULT_TEXT_BUFFER_SIZE @DEFAULT_TEXT_BUFFER_SIZE@
2222
#define MAX_NET_INTERFACES @MAX_NET_INTERFACES@
2323
#define HTTPPORT @HTTPPORT@
24+
#define PRESETS_REPO_URL "@PRESETS_REPO_URL@"
25+
#define PRESETS_REPO_PATH "@PRESETS_REPO_PATH@"
2426

2527
#cmakedefine BUILD_I18N 1
2628

@@ -55,7 +57,7 @@
5557
#cmakedefine BUILD_MOUSE_EVENTS 1
5658

5759
#cmakedefine BUILD_XDAMAGE 1
58-
60+
#cmakedefine BUILD_PRESETS 1
5961
#cmakedefine BUILD_XINERAMA 1
6062

6163
#cmakedefine BUILD_XFT 1

src/conky.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,12 +2156,12 @@ bool tryToReplaceAliasToPresetPath(std::string pathToPresetsRepo, std::string ur
21562156
if (current_config.empty()){
21572157
return false;
21582158
}
2159-
SystemGitRepoSource dataSource = SystemGitRepoSource(pathToPresetsRepo/*"/var/lib/conky/themes"*/, urlToCloneRepo/*"https://github.com/Cetttok/testRepoForConkyThemes"*/);
2160-
if (!dataSource.loadThemesDb()){
2159+
advanced_git_repo_source dataSource = advanced_git_repo_source(pathToPresetsRepo/*"/var/lib/conky/themes"*/, urlToCloneRepo/*"https://github.com/Cetttok/testRepoForConkyThemes"*/);
2160+
if (!dataSource.load_themes_db()){
21612161
return false;
21622162
}
2163-
ThemesPresetManager presets(&dataSource);
2164-
std::string configPath = presets.getThemePath(current_config);
2163+
theme_presets_manager presets(&dataSource);
2164+
std::string configPath = presets.get_theme_path(current_config);
21652165
if ( configPath.empty()){
21662166
return false;
21672167
}

src/main.cc

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
#include "output/x11.h"
4141
#endif /* BUILD_X11 */
4242

43+
#ifdef BUILD_PRESETS
44+
#include "themespresetmanager.h"
45+
#endif
46+
4347
#ifdef BUILD_CURL
4448
#include "data/network/ccurl_thread.h"
4549
#endif /* BUILD_CURL */
@@ -69,7 +73,7 @@
6973

7074
#ifdef BUILD_OLD_CONFIG
7175
#include "convertconf.h"
72-
#include "themespresetmanager.h"
76+
7377
#endif /* BUILD_OLD_CONFIG */
7478
#endif /* BUILD_BUILTIN_CONFIG */
7579

@@ -301,8 +305,8 @@ inline void reset_optind() {
301305
optind = 0;
302306
#endif
303307
}
304-
const char * THEME_PRESETS_REPO_CLONING_URL = "https://github.com/Cetttok/testRepoForConkyThemes"; // it is example need to create norm repo
305-
const char * THEME_PRESETS_REPO_PATH = "/var/lib/conky/themes";
308+
// const char * THEME_PRESETS_REPO_CLONING_URL = "https://github.com/Cetttok/testRepoForConkyThemes"; // it is example need to create norm repo
309+
// const char * THEME_PRESETS_REPO_PATH = "/var/lib/conky/themes";
306310
int main(int argc, char **argv) {
307311
#ifdef BUILD_I18N
308312
setlocale(LC_ALL, "");
@@ -337,9 +341,6 @@ int main(int argc, char **argv) {
337341
NORM_ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL.");
338342
}
339343
#endif /* BUILD_X11 */
340-
// SystemGitRepoSource* dataSource = new SystemGitRepoSource("newdatabase","https://github.com/Cetttok/testRepoForConkyThemes");
341-
// ThemesPresetManager presets(dataSource);
342-
// std::cout << argc << argv << getopt_string << longopts << std::endl;
343344
while (1) {
344345
int c = getopt_long(argc, argv, getopt_string, longopts, nullptr);
345346

@@ -367,10 +368,6 @@ int main(int argc, char **argv) {
367368
case 'h':
368369
print_help(argv[0]);
369370
return 0;
370-
// case 'S':
371-
// std::cout << "optarg " << optarg << std::endl;
372-
// std::cout << presets.getThemePath(std::string(optarg)) << std::endl;
373-
// break;
374371
#ifdef BUILD_BUILTIN_CONFIG
375372
case 'C':
376373
std::cout << defconfig;
@@ -399,24 +396,12 @@ int main(int argc, char **argv) {
399396
return 0;
400397
}
401398
#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */
402-
////////
403-
///
404-
///
405-
///
406-
///
407-
///
408-
///
409-
/// ///
410-
/// ///
411-
///
412-
///
413-
///
414-
///
415-
/// ////
416399

417400
try {
418401
set_current_config();
419-
tryToReplaceAliasToPresetPath(THEME_PRESETS_REPO_PATH, THEME_PRESETS_REPO_CLONING_URL );
402+
#ifdef BUILD_PRESETS
403+
tryToReplaceAliasToPresetPath(PRESETS_REPO_PATH , PRESETS_REPO_URL);
404+
#endif
420405
state = std::make_unique<lua::state>();
421406

422407
conky::export_symbols(*state);

0 commit comments

Comments
 (0)