diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 5a70be6..d87dbcd 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -77,14 +77,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin add_library(${PROJECT_NAME} SHARED libublsettingsui-gtk3.c libublsettingsui-gtk3-save.c + libublsettingsui-gtk3.h ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}) -set(PUBLIC_HEADERS -${CMAKE_CURRENT_SOURCE_DIR}/include/libublsettingsui-gtk3.h -${CMAKE_CURRENT_SOURCE_DIR}/include/save-window/libublsettingsui-gtk3-save.h -${CMAKE_CURRENT_SOURCE_DIR}/include/strings/libublsettingsui-gtk3-strings.h -) - set(LIBRARIES ${GTK_LIBRARIES} ${WEBKIT_LIBRARIES} @@ -99,24 +94,18 @@ add_definitions(-DLIBUBLSETTINGSUI_VERSION=${VERSION}) message(STATUS ${VERSION}) message(${CMAKE_INSTALL_LIBDIR}) -target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR} - $ - $ -) +target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR}) + target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES}) set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C) set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}) -# set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER ${PROJECT_NAME}.h) +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER ${PROJECT_NAME}.h) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") -set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libublsettingsui-gtk3 -) # Set pkg-config file to install. \ No newline at end of file diff --git a/source/include/save-window/libublsettingsui-gtk3-save.h b/source/include/save-window/libublsettingsui-gtk3-save.h deleted file mode 100644 index 7d1999f..0000000 --- a/source/include/save-window/libublsettingsui-gtk3-save.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef LIB_UBLSETTINGS_UI_SAVE -#define LIB_UBLSETTINGS_UI_SAVE -#include "libublsettingsui-gtk3.h" - -typedef struct { - GtkWidget *Window; - GtkWidget *HeaderTopic; - GtkWidget *HeaderImage; - GtkWidget *StatusBox; - GtkWidget *ParametersTree; - GtkCellRenderer *ToggleCell; - GtkWidget *CancelButton; - GtkWidget *SaveButton; - GtkListStore *list; - GtkTreeModel *filteredModel; - GtkTreeViewColumn *OldValueColumn; - GtkCellRenderer *OldValueCell; - GtkTreeViewColumn *NewValueColumn; - GtkCellRenderer *NewValueCell; - YON_CONFIG_TYPE type; - char *custom_save_path; -} template_saving_window; - - -void yon_save_window_set_postsave_function(void *function, void *data); - -template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...); -#endif \ No newline at end of file diff --git a/source/include/strings/libublsettingsui-gtk3-strings.h b/source/include/strings/libublsettingsui-gtk3-strings.h deleted file mode 100644 index 37a41e4..0000000 --- a/source/include/strings/libublsettingsui-gtk3-strings.h +++ /dev/null @@ -1,72 +0,0 @@ - -#ifndef UBL_SETTINGS_UI_STRINGS -#define UBL_SETTINGS_UI_STRINGS - #define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",NULL) - #define HELP_LABEL(rest) yon_char_unite(template_app_information.app_tech_name,_(" version:")," ", !yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",template_app_information.app_title,"\n",_("Usage:"), " ",template_app_information.app_tech_name," ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n\t--clear-config\t\t\t",_("Reset application settings"),"\n",!yon_char_is_empty(rest)?rest:NULL,NULL) - - #define template_ui_LocalePath "/usr/share/locale" - #define template_ui_LocaleName "libublsettingsui-gtk3" - - #define SUCCESS_LABEL _("Operation succeeded") - #define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked") - - #define ABOUT_LABEL _("About") - #define DOCUMENTATION_LABEL _("Documentation") - - #define SAVE_CUSTOM_LABEL _("Save to specific file") - #define SAVE_LOCAL_LABEL _("Save to local configuration") - #define SAVE_GLOBAL_LABEL _("Save to global configuration") - #define SAVE_CONFIGURATION_LABEL _("Save configuration") - #define SAVE_LABEL _("Save") - #define SAVE_PROCESS_LABEL _("Saving...") - - #define LOAD_CUSTOM_LABEL _("Load from specific file") - #define LOAD_LOCAL_LABEL _("Load local configuration") - #define LOAD_GLOBAL_LABEL _("Load global configuration") - #define LOAD_LABEL _("Load") - - #define CANCEL_LABEL _("Cancel") - #define ACCEPT_LABEL _("Accept") - #define OPEN_LABEL _("Open") - - #define HELP_TITLE_LABEL _("Would you like to read documentation in the Web?") - #define HELP_INFO_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.") - #define HELP_ALWAYS_OPEN_LABEL _("Always redirect to online documentation") - #define OPEN_HELP_LABEL _("Open documentation") - #define PROJECT_HOME_LABEL _("Project Home Page") - #define NOTHING_CHOSEN_LABEL _("Nothing were chosen") - #define AUTHORS_LABEL _(L"Copyright © 2022 - 2023, UBSoft LLC") - - - #define GLOBAL_LOAD_SUCCESS_LABEL _("Global configuration loading succeeded.") - #define LOCAL_LOAD_SUCCESS_LABEL _("Local configuration loading succeeded.") - #define LOAD_FAILED_LABEL _("Config loading failed") - - #define GLOBAL_LOCAL_SAVE_SUCCESS_LABEL _("Local and global configuration saving succeeded.") - #define GLOBAL_SAVE_SUCCESS_LABEL _("Global configuration saving succeeded.") - #define LOCAL_SAVE_SUCCESS_LABEL _("Local configuration saving succeeded.") - - #define PARAMETER_LABEL _("Parameter") - #define OLD_VALUE_LABEL _("Old value") - #define NEW_VALUE_LABEL _("New value") - #define COMPARE_VALUE_LABEL _("Value\n(Old/New)") - - #define NOTHING_TO_SAVE_LABEL _("Nothing to save") - #define SAVING_LOCAL_STATE_LABEL _("Saving into local configuration") - #define SAVING_GLOBAL_STATE_LABEL _("Saving into global configuration") - #define SAVING_GLOBAL_LOCAL_STATE_LABEL _("Saving into global and local configuration") - #define SAVING_CUSTOM_STATE_LABEL(target_path) yon_char_unite(_("Saving into custom configuration at")," ",target_path,NULL) - - #define SYSTEMBOOT_STATEMODE "SYSTEMBOOT_STATEMODE" - #define SYSTEMBOOT_STATEMODE_SECTION "[system]" - - #define SAVE_MODE_FULL_LABEL _("Full saving mode") - #define SAVE_MODE_MODULE_LABEL _("Saving into module") - #define SAVE_MODE_SANDBOX_LABEL _("Sandbox mode") - #define SAVE_MODE_RAM_HOME_LABEL _("Sandbox with profile saving") - #define SAVE_MODE_HDD_LABEL _("HDD sandbox") - #define SAVE_MODE_HDD_HOME_LABEL _("HDD sandbox with profile saving") - #define CUSTOM_CONFIG_CREATION_ERROR_LABEL _("New configuration file creation failed") - #define ROOT_CHECK_LABEL _("Upgrade to root") - #define SETTINGS_TITLE_LABEL _("Settings") -#endif \ No newline at end of file diff --git a/source/libublsettingsui-gtk3-save.c b/source/libublsettingsui-gtk3-save.c index 2b27eb0..aec51f0 100644 --- a/source/libublsettingsui-gtk3-save.c +++ b/source/libublsettingsui-gtk3-save.c @@ -1,4 +1,3 @@ -#include "save-window/libublsettingsui-gtk3-save.h" #include "libublsettingsui-gtk3.h" struct loaded_config { @@ -141,7 +140,7 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe for_dictionaries(current,target){ dictionary *cur_section=NULL; if (sections&&(cur_section=yon_dictionary_get(§ions,current->section))){ - char *temp = yon_char_unite((char*)cur_section->data," ", current->key,"='",(char*)current->data,"'",NULL); + char *temp = yon_char_unite((char*)cur_section->data," ", current->key,"=\'",(char*)current->data,"\'",NULL); free(current->data); current->data = temp; } else { diff --git a/source/include/libublsettingsui-gtk3.h b/source/libublsettingsui-gtk3.h similarity index 57% rename from source/include/libublsettingsui-gtk3.h rename to source/libublsettingsui-gtk3.h index be4bf96..f9884fe 100644 --- a/source/include/libublsettingsui-gtk3.h +++ b/source/libublsettingsui-gtk3.h @@ -4,8 +4,6 @@ #include #include #include -#include "save-window/libublsettingsui-gtk3-save.h" -#include "strings/libublsettingsui-gtk3-strings.h" #include #include #include @@ -222,4 +220,98 @@ void yon_gtk_scrolled_window_set_horizontal_at_desired_size(GtkWidget *window, G template_app_info yon_ubl_get_app_info(); + +typedef struct { + GtkWidget *Window; + GtkWidget *HeaderTopic; + GtkWidget *HeaderImage; + GtkWidget *StatusBox; + GtkWidget *ParametersTree; + GtkCellRenderer *ToggleCell; + GtkWidget *CancelButton; + GtkWidget *SaveButton; + GtkListStore *list; + GtkTreeModel *filteredModel; + GtkTreeViewColumn *OldValueColumn; + GtkCellRenderer *OldValueCell; + GtkTreeViewColumn *NewValueColumn; + GtkCellRenderer *NewValueCell; + YON_CONFIG_TYPE type; + char *custom_save_path; +} template_saving_window; + + +void yon_save_window_set_postsave_function(void *function, void *data); + +template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...); + + + #define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",NULL) + #define HELP_LABEL(rest) yon_char_unite(template_app_information.app_tech_name,_(" version:")," ", !yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",template_app_information.app_title,"\n",_("Usage:"), " ",template_app_information.app_tech_name," ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n\t--clear-config\t\t\t",_("Reset application settings"),"\n",!yon_char_is_empty(rest)?rest:NULL,NULL) + + #define template_ui_LocalePath "/usr/share/locale" + #define template_ui_LocaleName "libublsettingsui-gtk3" + + #define SUCCESS_LABEL _("Operation succeeded") + #define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked") + + #define ABOUT_LABEL _("About") + #define DOCUMENTATION_LABEL _("Documentation") + + #define SAVE_CUSTOM_LABEL _("Save to specific file") + #define SAVE_LOCAL_LABEL _("Save to local configuration") + #define SAVE_GLOBAL_LABEL _("Save to global configuration") + #define SAVE_CONFIGURATION_LABEL _("Save configuration") + #define SAVE_LABEL _("Save") + #define SAVE_PROCESS_LABEL _("Saving...") + + #define LOAD_CUSTOM_LABEL _("Load from specific file") + #define LOAD_LOCAL_LABEL _("Load local configuration") + #define LOAD_GLOBAL_LABEL _("Load global configuration") + #define LOAD_LABEL _("Load") + + #define CANCEL_LABEL _("Cancel") + #define ACCEPT_LABEL _("Accept") + #define OPEN_LABEL _("Open") + + #define HELP_TITLE_LABEL _("Would you like to read documentation in the Web?") + #define HELP_INFO_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.") + #define HELP_ALWAYS_OPEN_LABEL _("Always redirect to online documentation") + #define OPEN_HELP_LABEL _("Open documentation") + #define PROJECT_HOME_LABEL _("Project Home Page") + #define NOTHING_CHOSEN_LABEL _("Nothing were chosen") + #define AUTHORS_LABEL _(L"Copyright © 2022 - 2023, UBSoft LLC") + + + #define GLOBAL_LOAD_SUCCESS_LABEL _("Global configuration loading succeeded.") + #define LOCAL_LOAD_SUCCESS_LABEL _("Local configuration loading succeeded.") + #define LOAD_FAILED_LABEL _("Config loading failed") + + #define GLOBAL_LOCAL_SAVE_SUCCESS_LABEL _("Local and global configuration saving succeeded.") + #define GLOBAL_SAVE_SUCCESS_LABEL _("Global configuration saving succeeded.") + #define LOCAL_SAVE_SUCCESS_LABEL _("Local configuration saving succeeded.") + + #define PARAMETER_LABEL _("Parameter") + #define OLD_VALUE_LABEL _("Old value") + #define NEW_VALUE_LABEL _("New value") + #define COMPARE_VALUE_LABEL _("Value\n(Old/New)") + + #define NOTHING_TO_SAVE_LABEL _("Nothing to save") + #define SAVING_LOCAL_STATE_LABEL _("Saving into local configuration") + #define SAVING_GLOBAL_STATE_LABEL _("Saving into global configuration") + #define SAVING_GLOBAL_LOCAL_STATE_LABEL _("Saving into global and local configuration") + #define SAVING_CUSTOM_STATE_LABEL(target_path) yon_char_unite(_("Saving into custom configuration at")," ",target_path,NULL) + + #define SYSTEMBOOT_STATEMODE "SYSTEMBOOT_STATEMODE" + #define SYSTEMBOOT_STATEMODE_SECTION "[system]" + + #define SAVE_MODE_FULL_LABEL _("Full saving mode") + #define SAVE_MODE_MODULE_LABEL _("Saving into module") + #define SAVE_MODE_SANDBOX_LABEL _("Sandbox mode") + #define SAVE_MODE_RAM_HOME_LABEL _("Sandbox with profile saving") + #define SAVE_MODE_HDD_LABEL _("HDD sandbox") + #define SAVE_MODE_HDD_HOME_LABEL _("HDD sandbox with profile saving") + #define CUSTOM_CONFIG_CREATION_ERROR_LABEL _("New configuration file creation failed") + #define ROOT_CHECK_LABEL _("Upgrade to root") + #define SETTINGS_TITLE_LABEL _("Settings") #endif \ No newline at end of file