diff --git a/.gitignore b/.gitignore index 199a2c2..80133a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,14 @@ .vscode/ *# +ubl-settings-repomanager ubl-settings-TEMPLATE +ubl-settings-repo-back/ubl-settings-repo-back *~ build/ compile/ terminal-commands/ +source/ubl-cmake.h .BUILD.md +.updatebuild.sh .install.sh -ubl-settings-repomanager -.updatebuild.sh \ No newline at end of file +*vgcore* diff --git a/Makefile b/Makefile index 9c63112..b869cb7 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ DEPENDS = /bin/cmake PREFIX ?= /usr/local PKGNAME = $(MAKEFILE_DIR) FILE_VER = source/${PKGNAME}.h +PKGIDENT=$(subst /,-,${PREFIX}) default_target: all @@ -74,7 +75,7 @@ uninstall: @for FILE_PO in $(wildcard *.po); do \ LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ $(RM) "$${PATH_FILE_MO}"; \ done @for SIZE in 16x16 32x32 48x48 scalable; do \ @@ -89,7 +90,7 @@ uninstall: @$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}" @$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop" @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" - @$(RM) "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}.policy" + @$(RM) "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}${PKGIDENT}.policy" @if [ -z ${DESTDIR} ]; then \ [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \ update-desktop-database --quiet &>/dev/null || true; \ @@ -101,9 +102,9 @@ install: check uninstall @echo "Install ..." @for FILE_PO in $(wildcard *.po); do \ LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ - install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \ + install -dm755 "${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES"; \ FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ echo "$${FILE_PO}"; \ msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \ done @@ -112,9 +113,8 @@ install: check uninstall rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \ done @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" - @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg" - @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg" - @install -Dm644 -t "${DESTDIR}/usr/share/polkit-1/actions/" "com.ublinux.${PKGNAME}.policy" + @cp ./com.ublinux.${PKGNAME}.policy ./compile/com.ublinux.${PKGNAME}${PKGIDENT}.policy + @sed -e 's+/usr/bin+${PREFIX}/bin+' -e 's+.run+${PKGIDENT}.run+g' ./compile/com.ublinux.${PKGNAME}${PKGIDENT}.policy -i @install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg" @@ -122,10 +122,12 @@ install: check uninstall @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.document-symbolic.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.document-green-symbolic.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.document-red-symbolic.svg" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.document-sign-symbolic.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.folder-symbolic.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.folder-green-symbolic.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.folder-red-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/polkit-1/actions/" "${CMAKE_BUILD_DIR}/com.ublinux.${PKGNAME}${PKGIDENT}.policy" @if [ -z ${DESTDIR} ]; then \ [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \ update-desktop-database --quiet &>/dev/null || true; \ diff --git a/README.md b/README.md index ca5f2a3..a9e1fda 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ubl-settings-repomanager # Выполнить # Build -In order to build ubl-settings-TEMPLATE you will need: +In order to build ubl-settings-repomanager you will need: - CMake - C compiler diff --git a/VERSION.md b/VERSION.md deleted file mode 100644 index 12ebd01..0000000 --- a/VERSION.md +++ /dev/null @@ -1 +0,0 @@ -VERSION 1.0 diff --git a/com.ublinux.ubl-settings-repomanager.document-green-symbolic.svg b/com.ublinux.ubl-settings-repomanager.document-green-symbolic.svg new file mode 100644 index 0000000..76ab9d2 --- /dev/null +++ b/com.ublinux.ubl-settings-repomanager.document-green-symbolic.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + diff --git a/com.ublinux.ubl-settings-repomanager.document-red-symbolic.svg b/com.ublinux.ubl-settings-repomanager.document-red-symbolic.svg new file mode 100644 index 0000000..1233c4d --- /dev/null +++ b/com.ublinux.ubl-settings-repomanager.document-red-symbolic.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + diff --git a/com.ublinux.ubl-settings-repomanager.document-sign-symbolic.svg b/com.ublinux.ubl-settings-repomanager.document-sign-symbolic.svg new file mode 100644 index 0000000..a11cbf1 --- /dev/null +++ b/com.ublinux.ubl-settings-repomanager.document-sign-symbolic.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + diff --git a/com.ublinux.ubl-settings-repomanager.document-symbolic.svg b/com.ublinux.ubl-settings-repomanager.document-symbolic.svg new file mode 100644 index 0000000..a0b2a8d --- /dev/null +++ b/com.ublinux.ubl-settings-repomanager.document-symbolic.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/com.ublinux.ubl-settings-repomanager.folder-green-symbolic.svg b/com.ublinux.ubl-settings-repomanager.folder-green-symbolic.svg new file mode 100644 index 0000000..935dacf --- /dev/null +++ b/com.ublinux.ubl-settings-repomanager.folder-green-symbolic.svg @@ -0,0 +1,48 @@ + + + + + + + + + diff --git a/com.ublinux.ubl-settings-repomanager.folder-red-symbolic.svg b/com.ublinux.ubl-settings-repomanager.folder-red-symbolic.svg new file mode 100644 index 0000000..ad9da41 --- /dev/null +++ b/com.ublinux.ubl-settings-repomanager.folder-red-symbolic.svg @@ -0,0 +1,48 @@ + + + + + + + + + diff --git a/com.ublinux.ubl-settings-repomanager.folder-symbolic.svg b/com.ublinux.ubl-settings-repomanager.folder-symbolic.svg new file mode 100644 index 0000000..9373086 --- /dev/null +++ b/com.ublinux.ubl-settings-repomanager.folder-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/com.ublinux.ubl-settings-repomanager.svg b/com.ublinux.ubl-settings-repomanager.svg index f636c26..add01b7 100644 --- a/com.ublinux.ubl-settings-repomanager.svg +++ b/com.ublinux.ubl-settings-repomanager.svg @@ -4,8 +4,8 @@ height="180" version="1.0" id="svg8" - sodipodi:docname="ublinux-ubconfig.svg" - inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" + sodipodi:docname="ubl-settings-repomanager.svg" + inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)" inkscape:export-filename="/media/Data/ShareMX/temp/archtoub_icons/ublinux-logo.png" inkscape:export-xdpi="136.53334" inkscape:export-ydpi="136.53334" @@ -2225,11 +2225,11 @@ + gradientTransform="matrix(3.779602,0,0,3.779602,-193.72728,-7.0470659)"> + + + + + + + + + + + + + + + + + + + + id="filter104568" + x="-0.16132975" + y="-0.15932729" + width="1.2893327" + height="1.2869388"> + id="feFlood104558" /> + id="feComposite104560" /> + id="feGaussianBlur104562" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="feOffset32783-4" /> + id="feComposite32785-3" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + inkscape:current-layer="layer3"> + + + inkscape:label="ubinstall_gui" + style="display:none"> - + id="g2035" + transform="matrix(1.7064512,0,0,1.7064512,182.08962,45.305852)" + style="filter:url(#filter104568)"> + + + + + + + + + + + + + cx="4.7361059" + cy="12.475146" + r="3.9282389" + fill="url(#linearGradient3529)" + stroke-width="0.927939" + id="circle34" + style="fill:url(#linearGradient3529)" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cx="4.7361059" + cy="12.475146" + r="3.9282389" + fill="url(#linearGradient3529)" + stroke-width="0.927939" + id="circle34-6" + style="fill:url(#linearGradient3529-4)" /> + diff --git a/gresource.xml b/gresource.xml new file mode 100644 index 0000000..58afa6e --- /dev/null +++ b/gresource.xml @@ -0,0 +1,14 @@ + + + + ubl-settings-repomanager.glade + ubl-settings-repomanager-windows.glade + ubl-settings-repomanager-sign.glade + + + ubl-settings-repomanager.css + + + ubl-settings-repomanager-banner.png + + \ No newline at end of file diff --git a/screenshot/screensgot.png b/screenshot/screensgot.png new file mode 100644 index 0000000..723457c Binary files /dev/null and b/screenshot/screensgot.png differ diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 1e12993..4eb002d 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -21,13 +21,50 @@ endif() configure_file(ubl-cmake.in ubl-cmake.h) +file(COPY ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h DESTINATION ./) + +set(GRESOURCE_C resources.c) +set(GRESOURCE_XML gresource.xml) + +find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED) +add_custom_target(GLADE ubl-settings-repomanager.glade) + +set(DEPENDFILES + ../ubl-settings-repomanager.glade + ../ubl-settings-repomanager-windows.glade + ../ubl-settings-repomanager-sign.glade + ../gresource.xml + ../ubl-settings-repomanager-banner.png + ../ubl-settings-repomanager.css + ) + +file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_custom_command( + OUTPUT ${GRESOURCE_C} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${GLIB_COMPILE_RESOURCES} + ARGS + --generate-source + --target=${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} + ${GRESOURCE_XML} + VERBATIM + MAIN_DEPENDENCY ${GRESOURCE_XML} + DEPENDS + ${GLADE} +) +add_custom_target( + dummy-resource + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} +) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -lm") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ -O2 -pipe -fno-plt -fexceptions \ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ - -fstack-clash-protection -fcf-protection -g") + -fstack-clash-protection -fcf-protection") + set(SOURCE_FILES ubl-settings-repomanager.c @@ -35,7 +72,8 @@ set(SOURCE_FILES ubl-strings.h ubl-utils.h ubl-utils.c - ubl-cmake.h) + ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h + ) set(LIBRARIES ${GTK_LIBRARIES} @@ -43,7 +81,12 @@ set(LIBRARIES pthread) -add_executable(${PROJECT_NAME} ${SOURCE_FILES}) +add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}) target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES}) target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR}) -install(TARGETS ubl-settings-repomanager DESTINATION bin) \ No newline at end of file +set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} + PROPERTIES GENERATED TRUE +) +install(TARGETS ${PROJECT_NAME} DESTINATION bin) +add_dependencies(${PROJECT_NAME} dummy-resource) \ No newline at end of file diff --git a/source/ubl-settings-repomanager.c b/source/ubl-settings-repomanager.c index 647733f..c6bf903 100644 --- a/source/ubl-settings-repomanager.c +++ b/source/ubl-settings-repomanager.c @@ -30,7 +30,7 @@ void yon_open_browser(GtkWidget *self, char *link){ */ void on_open_documentation_confirmation(GtkWidget *self, char *link){ if (main_config.always_open_documentation==0){ - GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); documentation_confirmation_window *widgets = malloc(sizeof(documentation_confirmation_window)); widgets->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow"); widgets->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton"); @@ -84,7 +84,7 @@ void on_link(GtkWidget *self, char* uri, gpointer user_data){ * Присоединять к сигналу "activate" кнопки справки типа MenuItem. */ void on_about(){ - GtkBuilder *builder=gtk_builder_new_from_file(glade_path); + GtkBuilder *builder=gtk_builder_new_from_resource(glade_path); GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow"); GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic"); GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); @@ -98,7 +98,565 @@ void on_about(){ gtk_widget_show(window); } +void on_load(){ + gsize size=0; + config_str repos = yon_window_config_get_section("repos",&size); + gtk_tree_store_clear(main_config.tree_store); + for (int i=0;i",-1); + + if (repostatus == 1) gtk_tree_store_set(main_config.tree_store,&iter,0,folder_no_edits,3,0,-1); + else if (repostatus == -1){ + system(yon_char_unite("rm -rfd ",origin_flagged,NULL)); + yon_window_config_erase_custom_parameter(origin_flagged,"repos"); + GtkTreeIter *deleteIter = gtk_tree_iter_copy(&iter); + if (!gtk_tree_model_iter_previous(GTK_TREE_MODEL(main_config.tree_store),deleteIter)){ + gtk_tree_iter_free(deleteIter); + deleteIter = gtk_tree_iter_copy(&iter); + if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.tree_store),deleteIter)){ + gtk_tree_iter_free(deleteIter); + deleteIter = gtk_tree_iter_copy(&iter); + gtk_tree_store_remove(main_config.tree_store,deleteIter); + break; + } else { + gtk_tree_store_remove(main_config.tree_store,&iter); + } + } else { + gtk_tree_store_remove(main_config.tree_store,&iter); + + } + continue; + } + gboolean valid_child=gtk_tree_model_iter_children(GTK_TREE_MODEL(main_config.tree_store),&childIter,&iter); + for (;valid_child;valid_child=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.tree_store),&childIter)){ + char *pack_name, *pack_path; + char *pack_old_repo, *pack_new_repo; + char *pack_code_name, *pack_version, *pack_arch, *pack_depends; + int pack_status=0; + gboolean moved=0; + char *pack_sign; + gboolean pack_signed=0; + + gtk_tree_model_get(GTK_TREE_MODEL(main_config.tree_store),&childIter,1,&pack_name,2,&pack_path,3,&pack_status,4,&pack_old_repo,5,&pack_new_repo,6,&moved,9,&pack_code_name,10,&pack_version,11,&pack_arch,12,&pack_depends,13,&pack_sign,14,&pack_signed,-1); + if (!pack_path) continue; + char *pack_sign_paths; + pack_sign_paths = yon_char_new(pack_path); + yon_char_divide(pack_sign_paths,yon_char_find_last(pack_sign_paths,'/')); + packnames = yon_char_unite(packnames ? yon_char_append(packnames," "):"",pack_sign_paths,NULL); + if (pack_sign&&pack_signed==1){ + yon_char_divide_search(pack_sign,"<",-1); + pack_sign=yon_char_divide_search(pack_sign,">",-1); + if (!pack_groups||!(yon_dictionary_get(&pack_groups,pack_sign))){ + dictionary *dict = yon_dictionary_new(); + dict->key = pack_sign_paths; + yon_dictionary_add_or_create_if_exists_with_data(pack_groups,yon_char_new(pack_sign),dict); + } else { + dictionary *dict = yon_dictionary_new(); + dict->key = pack_sign_paths; + yon_dictionary_add_or_create_if_exists_with_data(pack_groups->data,yon_char_new(pack_sign),dict); + } + } + if (pack_status==1){ + add_packages = yon_char_unite(add_packages ? yon_char_append(add_packages,",") : "",pack_path,NULL); + pack_path = yon_char_unite(origin_flagged,"/pool/overlay/",yon_char_divide(pack_path,yon_char_find_last(pack_path,'/'))); + gtk_tree_store_set(main_config.tree_store,&childIter,2,pack_path,-1); + } else if (pack_status==-1){ + remove_packages = yon_char_unite(remove_packages ? yon_char_append(remove_packages,",") : "",pack_code_name,NULL); + } + if (pack_status==1) gtk_tree_store_set(main_config.tree_store,&childIter,0,document_no_edits,3,0,-1); + if (pack_status == -1){ + GtkTreeIter *deleteIter = gtk_tree_iter_copy(&childIter); + if (!gtk_tree_model_iter_previous(GTK_TREE_MODEL(main_config.tree_store),deleteIter)){ + gtk_tree_iter_free(deleteIter); + deleteIter = gtk_tree_iter_copy(&childIter); + if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.tree_store),deleteIter)){ + gtk_tree_iter_free(deleteIter); + deleteIter = gtk_tree_iter_copy(&childIter); + gtk_tree_store_remove(main_config.tree_store,deleteIter); + break; + } else { + gtk_tree_store_remove(main_config.tree_store,&childIter); + } + } else { + gtk_tree_store_remove(main_config.tree_store,&childIter); + } + } + } + if (origin_flagged&&name_flagged){ + if (add_packages){ + char *sign_check = repo_sign_flagged ? yon_char_new(repo_sign_flagged) : NULL; + repo_sign_flagged=NULL; + add_command = yon_char_unite(command, " add -d \"",origin_flagged,"\" -r \"",name_flagged, sign_flagged ? yon_char_append("\" --sign-repo ",sign_flagged):"\"" ," -p ", add_packages,NULL); + } + if (remove_packages){ + char *sign_check = repo_sign_flagged ? yon_char_new(repo_sign_flagged) : NULL; + repo_sign_flagged=NULL; + remove_command = yon_char_unite(command, " remove -d \"",origin_flagged,"\" -r \"",name_flagged, sign_flagged ? yon_char_append("\" --sign-repo ",sign_flagged):"\"" , " -p ", remove_packages,NULL); + } + if (repostatus == 1){ + yon_window_config_add_custom_parameter(yon_char_unite(origin_flagged,NULL),"repos",packnames,YON_TYPE_STRING); + } + if (!add_packages&&!signed_packages&&!remove_packages&&repostatus==1) + add_command = yon_char_unite(command, " add -d \"",origin_flagged,"\" -r \"",name_flagged,sign_flagged ? yon_char_append("\" --sign-repo ",sign_flagged):"\"" ,NULL); + if (add_signed_command){/*printf("%s\n",add_signed_command);*/ system(add_signed_command); + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);} + if (add_command) {/*printf("%s\n",add_command);*/system(add_command); + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);} + if (remove_command) {/*printf("%s\n",remove_command);*/system(remove_command); + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);} + if (pack_groups){ + dictionary *dct; + for_dictionaries(dct,pack_groups){ + char *signed_packs=NULL; + dictionary *pck; + for_dictionaries(pck,yon_dictionary_get_data(dct,dictionary*)){ + signed_packs=yon_char_unite(signed_packs ? yon_char_append(signed_packs,","): "" ,pck->key,NULL); + } char *sign_check = repo_sign_flagged ? yon_char_new(repo_sign_flagged) : NULL; + repo_sign_flagged=NULL; + char *sign_command = yon_char_unite(command, " add -f -d ",origin_flagged," -r ",name_flagged," --sign-pkg ", dct->key," -p $(find ",origin_flagged,"/pool/overlay -name ", signed_packs,")",NULL); + printf("%s\n",sign_command); + system(sign_command); + } + + } + } + } +} + +void on_search(GtkCellEditable *self, main_window *widgets){ + GtkTreeIter iter, childIter; + char *name=NULL; + int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.tree_store),&iter); + for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.tree_store),&iter)){ + gtk_tree_model_get(GTK_TREE_MODEL(main_config.tree_store),&iter,1,&name,-1); + if (strstr(name,gtk_entry_get_text(GTK_ENTRY(widgets->Finder)))) { + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&iter); + return; + } + gtk_tree_view_expand_row(GTK_TREE_VIEW(widgets->RepoTree),gtk_tree_model_get_path(GTK_TREE_MODEL(main_config.tree_store),&iter),1); + int child_valid = gtk_tree_model_iter_children(GTK_TREE_MODEL(main_config.tree_store),&childIter,&iter); + for (;child_valid;child_valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(main_config.tree_store),&childIter)){ + gtk_tree_model_get(GTK_TREE_MODEL(main_config.tree_store),&childIter,1,&name,-1); + if (strstr(name,gtk_entry_get_text(GTK_ENTRY(widgets->Finder)))) { + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&childIter); + return; + } + + } + gtk_tree_view_expand_row(GTK_TREE_VIEW(widgets->RepoTree),gtk_tree_model_get_path(GTK_TREE_MODEL(main_config.tree_store),&iter),0); + } + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); +} + +void on_tree_selection_changed(GtkWidget *self,main_window *widgets){ + GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&iter)){ + char *codeName=NULL,*version=NULL,*architecture=NULL, *dependeces=NULL, *signature=NULL; + int serverType=0,trusted=0,published=0; + gtk_tree_model_get(model,&iter,9,&codeName,10,&version,11,&architecture,12,&dependeces,13,&signature,-1); + gtk_label_set_text(GTK_LABEL(widgets->CodeNameInfoLabel),codeName ? codeName : ""); + gtk_label_set_text(GTK_LABEL(widgets->VersionInfoLabel),version ? version : ""); + gtk_label_set_text(GTK_LABEL(widgets->ArchitectureInfoLabel),architecture ? architecture : ""); + gtk_label_set_text(GTK_LABEL(widgets->DependencesInfoLabel),dependeces ? dependeces : ""); + gtk_label_set_text(GTK_LABEL(widgets->SignatureInfoLabel),signature ? signature : ABSENT_LABEL); + int depth = gtk_tree_store_iter_depth(main_config.tree_store,&iter); + if (depth == 0){ + gtk_widget_set_sensitive(widgets->CreateButton,1); + gtk_widget_set_sensitive(widgets->LoadFromLocalButton,1); + gtk_widget_set_sensitive(widgets->ConfigureButton,1); + gtk_widget_set_sensitive(widgets->DeleteButton,1); + gtk_widget_set_sensitive(widgets->AddPackageButton,1); + gtk_widget_set_sensitive(widgets->RemovePackageButton,0); + gtk_widget_set_visible(widgets->NameBox,1); + gtk_widget_set_visible(widgets->DependenceBox,0); + gtk_widget_set_visible(widgets->VersionBox,0); + gtk_widget_set_visible(widgets->ArchitectureBox,0); + gtk_widget_set_visible(widgets->SignatureBox,1); + } else if (depth == 1){ + gtk_widget_set_sensitive(widgets->CreateButton,1); + gtk_widget_set_sensitive(widgets->LoadFromLocalButton,1); + gtk_widget_set_sensitive(widgets->ConfigureButton,0); + gtk_widget_set_sensitive(widgets->DeleteButton,0); + gtk_widget_set_sensitive(widgets->AddPackageButton,1); + gtk_widget_set_sensitive(widgets->RemovePackageButton,1); + gtk_widget_set_visible(widgets->NameBox,1); + gtk_widget_set_visible(widgets->DependenceBox,1); + gtk_widget_set_visible(widgets->VersionBox,1); + gtk_widget_set_visible(widgets->ArchitectureBox,1); + gtk_widget_set_visible(widgets->SignatureBox,1); + } + } +} + +void on_repo_add_new(GtkWidget *self, dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + repo_create_window *window = yon_dictionary_get_data(dict->first->next,repo_create_window*); + if (!window->path){ yon_ubl_status_box_render(CHOOSE_PATH_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); return;} + char *name=NULL; + + name = window->path; + if (!name||strcmp(name,"")!=0){ + GtkTreeIter *iter = yon_repo_append(widgets, name, YON_REPO_LINE_REPO_TYPE); + gtk_tree_store_set(main_config.tree_store,iter,0,folder_added,2,window->path,3,1,-1); + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + } else { + yon_ubl_status_box_render(EMPTY_NAME_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + } +} + +char *on_choose_repo_folder(GtkWidget *self,repo_create_window *window){ + GtkWidget *chooser = gtk_file_chooser_dialog_new(ADD_REPO_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); + gtk_window_set_icon_name(GTK_WINDOW(chooser),icon_path); + int res = gtk_dialog_run(GTK_DIALOG(chooser)); + if (res==GTK_RESPONSE_ACCEPT){ + + char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser)); + window->path=yon_char_new(filename); + } + on_close_subwindow(chooser); +} + +void on_repo_new (GtkWidget *self, main_window *widgets){ + repo_create_window *window = new(repo_create_window); + window->path=NULL; + on_choose_repo_folder(self,window); + dictionary *dict = yon_dictionary_new_with_data("",widgets); + dict = yon_dictionary_append_with_data(dict,"",window); + on_repo_add_new(self,dict); + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); +} + +void on_repo_add_file(GtkWidget *self, main_window *widgets){ + yon_add_file(widgets); +} + +void on_repo_remove_package(GtkWidget *self, main_window *widgets){ + yon_repo_remove_package(widgets); +} + +void on_repo_remove(GtkWidget *self, main_window *widgets){ + yon_repo_remove(widgets); +} + +void on_sign_save(GtkWidget *self, dictionary *dict){ + GtkTreeIter iter; + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + repo_sign_window *window = yon_dictionary_get_data(dict->first->next,repo_sign_window*); + GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&iter)){ + char *key = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->KeysCombo)); + gtk_tree_store_set(main_config.tree_store,&iter,13,key,14,1,-1); + } + on_tree_selection_changed(self,widgets); + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + on_close_subwindow(self); +} + +void on_repo_sign(GtkWidget *self, main_window *widgets){ + repo_sign_window *window = g_malloc(sizeof(repo_sign_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_sign_path); + window->Window = yon_gtk_builder_get_widget(builder,"repoSignWindow"); + window->HeaderLabel = yon_gtk_builder_get_widget(builder,"signHeaderNameLabel"); + window->KeysCombo = yon_gtk_builder_get_widget(builder,"repoSignKeysCombo"); + + window->SaveButton = yon_gtk_builder_get_widget(builder,"repoSignSaveButton"); + window->CloseButton = yon_gtk_builder_get_widget(builder,"repoSignCancelButton"); + GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&iter)){ + if (gtk_tree_store_iter_depth(main_config.tree_store,&iter)==1) + gtk_label_set_text(GTK_LABEL( window->HeaderLabel),yon_char_unite(DIGITAL_SIGNATURE_LABEL," - ",PACKAGE_LABEL,NULL)); + else + gtk_label_set_text(GTK_LABEL( window->HeaderLabel),yon_char_unite(DIGITAL_SIGNATURE_LABEL," - ",REPOSITORY_LABEL,NULL)); + int size=0; + config_str ret = yon_config_load(get_gpg_keys_command,&size); + for (int i=0;iKeysCombo),ret[i]); + } + dictionary *dict = yon_dictionary_new_with_data("",widgets); + dict = yon_dictionary_append_with_data(dict,"",window); + g_signal_connect(G_OBJECT(window->SaveButton),"clicked", G_CALLBACK(on_sign_save),dict); + g_signal_connect(G_OBJECT(window->CloseButton),"clicked", G_CALLBACK(on_close_subwindow),NULL); + + gtk_widget_show(window->Window); + } else { + yon_ubl_status_box_render(SIGN_CHOOSE_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + } +} + +void on_repo_configure(GtkWidget *self, main_window *widgets){ + GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&iter)){ + GtkBuilder *builder = gtk_builder_new_from_resource(glade_repo_path); + repo_create_window *window = new(repo_create_window); + window->Window=yon_gtk_builder_get_widget(builder,"repoEditWindow"); + window->NameEntry=yon_gtk_builder_get_widget(builder,"repoEditNameEntry"); + window->CancelButton=yon_gtk_builder_get_widget(builder,"repoEditCancelButton"); + window->SaveButton=yon_gtk_builder_get_widget(builder,"repoEditSaveButton"); + window->BranchesTree=yon_gtk_builder_get_widget(builder,"repoEditBranchTree"); + window->BranchesListStore=GTK_LIST_STORE(gtk_builder_get_object(builder,"curRepoEditList")); + gtk_widget_show(window->Window); + dictionary *dict = yon_dictionary_new_with_data("",widgets); + dict = yon_dictionary_append_with_data(dict,"",window); + g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_repo_configure_done),dict); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + gtk_list_store_clear(window->BranchesListStore); + } else yon_ubl_status_box_render(NOTHING_CHOSEN_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); +} + +void on_repo_configure_done(GtkWidget *self, dictionary *dict){ + main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); + repo_create_window *window = yon_dictionary_get_data(dict->first->next,repo_create_window*); + GtkTreeIter iter, parentIter; + GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&iter)){ + if (gtk_tree_model_iter_parent(GTK_TREE_MODEL(main_config.tree_store),&parentIter,&iter)) + iter=parentIter; + char *oldname=NULL; + int status=0; + char *name = (char*)gtk_entry_get_text(GTK_ENTRY(window->NameEntry)); + gtk_tree_model_get(model,&iter,1,&oldname,3,&status,-1); + if (status==0) + gtk_tree_store_set(main_config.tree_store,&iter,1,name,4,oldname,6,1,-1); + else if (status==1) + gtk_tree_store_set(main_config.tree_store,&iter,1,name,-1); + } + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + on_close_subwindow(self); +} + +void on_repo_load_local(GtkWidget *self, main_window *widgets){ + GtkFileFilter *file_filter = gtk_file_filter_new(); + GtkWidget *chooser = gtk_file_chooser_dialog_new(LOAD_REPO_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_OPEN,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); + gtk_file_filter_add_pattern(file_filter,"*db.tar.gz"); + gtk_file_filter_set_name(file_filter, "*db.tar.gz"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser),file_filter); + int res = gtk_dialog_run(GTK_DIALOG(chooser)); + if (res==GTK_RESPONSE_ACCEPT){ + + char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser)); + while (1){ + char *ret = yon_char_divide_search(filename,"/",-1); + if (strcmp(ret,filename)==0) break; + } + yon_repo_append(widgets,filename,YON_REPO_LINE_REPO_TYPE); + } + on_close_subwindow(chooser); +} + +GtkTreeIter *yon_repo_append(main_window *widgets, char *name, YON_REPO_LINE_TYPE type){ + GtkTreeIter *retIter=g_malloc0(sizeof(GtkTreeIter)); + GtkTreeIter iter,parentIter; + GtkIconTheme *theme = gtk_icon_theme_get_default(); + char *name_short = yon_char_new(name); + gboolean fls = 0; + while(1){ + yon_char_divide_search(name_short,"/",-1); + if (!strstr(name_short,"/")) break; + } + GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&parentIter)){ + if (type==YON_REPO_LINE_REPO_TYPE){ + gtk_tree_store_append(main_config.tree_store,&iter,NULL); + gtk_tree_store_set(main_config.tree_store,&iter,0, folder_no_edits, 1, name_short,2,name,3,1,4,fls,-1); + retIter = gtk_tree_iter_copy(&iter); + } + else if (type==YON_REPO_LINE_FILE_TYPE){ + GtkTreeIter branch; + if (gtk_tree_model_iter_parent(model,&branch,&parentIter)){ + GtkTreeIter repo; + gtk_tree_store_append(main_config.tree_store,&iter,&branch); + gtk_tree_store_set(main_config.tree_store,&iter,0, document_no_edits, 1, name_short,2,name,3,1,4,fls,-1); + retIter = gtk_tree_iter_copy(&iter); + + } else { + gtk_tree_store_append(main_config.tree_store,&iter,&parentIter); + gtk_tree_store_set(main_config.tree_store,&iter,0, document_no_edits, 1, name_short,2,name,3,1,4,fls,-1); + retIter = gtk_tree_iter_copy(&iter); + } + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + } + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&iter); + } + else if (type==YON_REPO_LINE_REPO_TYPE){ + gtk_tree_store_append(main_config.tree_store,&iter,NULL); + gtk_tree_store_set(main_config.tree_store,&iter,0, folder_no_edits, 1, name_short,2,name,3,1,4,fls,-1); + retIter = gtk_tree_iter_copy(&iter); + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&iter); + } else { + yon_ubl_status_box_render(NOTHING_CHOSEN_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + } + return retIter; +} + +void yon_repo_remove_package(main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&iter)){ + GtkTreeIter iterparent; + if (gtk_tree_model_iter_parent(model,&iterparent,&iter)){ + int status = 0; + gtk_tree_model_get(GTK_TREE_MODEL(main_config.tree_store),&iter,3,&status,-1); + if (status != 1){ + gtk_tree_store_set(main_config.tree_store,&iter,3,-1,-1); + gtk_tree_store_set(main_config.tree_store,&iter,0,document_deleted,-1); + } else gtk_tree_store_remove(main_config.tree_store,&iter); + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + }else yon_ubl_status_box_render(CHOOSE_PACK_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + } +} + +void yon_repo_remove(main_window *widgets){ + GtkTreeIter iter, childIter, *deletecopy; + GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&iter)){ + if(gtk_tree_store_iter_depth(main_config.tree_store,&iter)==0){ + int repostatus=0; + gtk_tree_model_get(GTK_TREE_MODEL(main_config.tree_store),&iter,3,&repostatus,-1); + if (repostatus ==0){ + gtk_tree_store_set(main_config.tree_store,&iter,3,-1,0,folder_deleted,-1); + int valid=gtk_tree_model_iter_children(model,&childIter,&iter); + for (;valid;valid=gtk_tree_model_iter_next(model,&childIter)){ + int status=5; + gtk_tree_model_get(model,&childIter,3,&status,-1); + if (status==1){ + deletecopy = gtk_tree_iter_copy(&childIter); + gtk_tree_model_iter_previous(model,&childIter); + gtk_tree_store_remove(main_config.tree_store,deletecopy); + } else if (status == 0){ + gtk_tree_store_set(main_config.tree_store,&childIter, 0,document_deleted,3,-1,-1); + } + } + } else if (repostatus == 1) { + gtk_tree_store_remove(main_config.tree_store,&iter); + } + }else yon_ubl_status_box_render(CHOOSE_REPO_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + } else yon_ubl_status_box_render(NOTHING_CHOSEN_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); +} + +void yon_add_file(main_window *widgets){ + GtkWidget *chooser = gtk_file_chooser_dialog_new(ADD_PACKAGE_REPO_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_OPEN,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); + GtkFileFilter *file_filter = gtk_file_filter_new(); + file_filter = gtk_file_filter_new(); + gtk_file_filter_add_pattern(file_filter,"*.pkg.tar.*"); + gtk_file_filter_set_name(file_filter,".pkg.tar.*"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser),file_filter); + file_filter = gtk_file_filter_new(); + gtk_file_filter_add_pattern(file_filter,"*"); + gtk_file_filter_set_name(file_filter,"All"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser),file_filter); + int res = gtk_dialog_run(GTK_DIALOG(chooser)); + if (res==GTK_RESPONSE_ACCEPT){ + char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser)); + FILE *file = popen(get_package_info_command(filename),"r"); + char *cur_string=g_malloc0(sizeof(char)*4096); + char *packname=NULL, *packver=NULL, *packarch=NULL, *packdepends=NULL; + while (fgets(cur_string,4096,file)){ + char *stringe = yon_char_divide_search(cur_string,"\n",-1); + char *p = yon_char_divide_search(stringe,":",-1); + if (strstr(p,"Name")) packname = yon_char_new(stringe); + else if (strstr(p,"Version")) packver = yon_char_new(stringe); + else if (strstr(p,"Architecture")) packarch = yon_char_new(stringe); + else if (strstr(p,"Depends On")) packdepends = yon_char_new(stringe); + else if (strstr(p,"Depends On")) packdepends = yon_char_new(stringe); + } + GtkTreeIter *iter = yon_repo_append(widgets,filename,YON_REPO_LINE_FILE_TYPE); + gtk_tree_view_expand_to_path(GTK_TREE_VIEW(widgets->RepoTree),gtk_tree_model_get_path(GTK_TREE_MODEL(main_config.tree_store),iter)); + gtk_tree_store_set(main_config.tree_store,iter,0,document_added,1,yon_char_unite(packname,"-",packver,"-",packarch,NULL),2,filename,9,packname,10,packver,11,packarch,12,packdepends,-1); + + } + on_tree_selection_changed(NULL,widgets); + yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + on_close_subwindow(chooser); + + +} + + + /* setup functions */ void config_init(){ + main_config.tree_store=NULL; main_config.always_open_documentation=0; main_config.win_height=0; main_config.win_width=0; @@ -117,10 +675,11 @@ void config_init(){ main_window *setup_window(){ /* Widgets getting | Получение виджетов */ main_window *widgets = malloc(sizeof(main_window)); - GtkBuilder *builder = gtk_builder_new_from_file(glade_path); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); widgets->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); widgets->HatLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); widgets->PlugBox = yon_gtk_builder_get_widget(builder,"plugBox"); + widgets->MovePaned = yon_gtk_builder_get_widget(builder,"MovePaned"); widgets->HeadOverlay = yon_gtk_builder_get_widget(builder,"HeadOverlay"); widgets->HeadImage = yon_gtk_builder_get_widget(builder,"HeadBackgroundImage"); @@ -143,9 +702,6 @@ main_window *setup_window(){ widgets->LoadLocalMenuItem = yon_gtk_builder_get_widget(builder,"LoadLocalConfigurationMenuItem"); widgets->LeftBox = yon_gtk_builder_get_widget(builder,"HeaderLeftBox"); - widgets->DocumentationMenuItem = yon_gtk_builder_get_widget(builder,"DocumentationMenuItem"); - widgets->AboutMenuItem = yon_gtk_builder_get_widget(builder,"AboutMenuItem"); - widgets->GeneralTabLabel = yon_gtk_builder_get_widget(builder,"GeneralTabLabel"); widgets->PublicationTabLabel = yon_gtk_builder_get_widget(builder,"PublicationTabLabel"); widgets->CreateButton = yon_gtk_builder_get_widget(builder,"CreateButton"); @@ -178,10 +734,26 @@ main_window *setup_window(){ widgets->ArchitectureLabel = yon_gtk_builder_get_widget(builder,"ArchitectureLabel"); widgets->ArchitectureInfoLabel = yon_gtk_builder_get_widget(builder,"ArchitectureInfoLabel"); widgets->ComponentsLabel = yon_gtk_builder_get_widget(builder,"ComponentsLabel"); - widgets->ComponentsInfoLabel = yon_gtk_builder_get_widget(builder,"ComponentsInfoLabel"); + widgets->DependencesInfoLabel = yon_gtk_builder_get_widget(builder,"DependencesInfoLabel"); widgets->SignatureLabel = yon_gtk_builder_get_widget(builder,"SignatureLabel"); widgets->SignatureInfoLabel = yon_gtk_builder_get_widget(builder,"SignatureInfoLabel"); - widgets->Finder = yon_gtk_builder_get_widget(builder,"SignatureInfoLabel"); + widgets->Finder = yon_gtk_builder_get_widget(builder,"RepoFinder"); + widgets->NameBox = yon_gtk_builder_get_widget(builder,"nameBox"); + widgets->VersionBox = yon_gtk_builder_get_widget(builder,"versionBox"); + widgets->ArchitectureBox = yon_gtk_builder_get_widget(builder,"archBox"); + widgets->DependenceBox = yon_gtk_builder_get_widget(builder,"dependBox"); + widgets->SignatureBox = yon_gtk_builder_get_widget(builder,"signatureBox"); + widgets->SaveButton = yon_gtk_builder_get_widget(builder,"mainSaveButton"); + main_config.tree_store = GTK_TREE_STORE(gtk_builder_get_object(builder,"RepoStore")); + + widgets->DocumentationMenuItem = yon_ubl_menu_item_documentation_new(DOCUMENTATION_LABEL); + widgets->AboutMenuItem = yon_ubl_menu_item_about_new(ABOUT_LABEL); + + gtk_window_set_title(GTK_WINDOW(widgets->Window),TITLE_LABEL); + + GtkWidget *menu = yon_gtk_builder_get_widget(builder,"menu2"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->DocumentationMenuItem); + gtk_menu_shell_append(GTK_MENU_SHELL(menu),widgets->AboutMenuItem); if (main_config.lock_load_global == 1){ gtk_widget_set_sensitive(widgets->LoadGlobalMenuItem,0); @@ -199,53 +771,29 @@ main_window *setup_window(){ } } + + /* Widget registration for config monitoring | Регистрация виджетов для мониторинга конфига */ + yon_window_config_add_listener(widgets->MovePaned,"pane_position","position",YON_TYPE_INT); + /* Signal connection | Присоединение сигналов */ g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK); g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),NULL); + g_signal_connect(G_OBJECT(widgets->CreateButton),"clicked",G_CALLBACK(on_repo_new),widgets); + g_signal_connect(G_OBJECT(widgets->AddPackageButton),"clicked",G_CALLBACK(on_repo_add_file),widgets); + g_signal_connect(G_OBJECT(widgets->RemovePackageButton),"clicked",G_CALLBACK(on_repo_remove_package),widgets); + g_signal_connect(G_OBJECT(widgets->DeleteButton),"clicked",G_CALLBACK(on_repo_remove),widgets); + g_signal_connect(G_OBJECT(widgets->LoadFromLocalButton),"clicked",G_CALLBACK(on_repo_load_local),widgets); + g_signal_connect(G_OBJECT(widgets->ConfigureButton),"clicked",G_CALLBACK(on_repo_configure),widgets); + g_signal_connect(G_OBJECT(widgets->SignButton),"clicked",G_CALLBACK(on_repo_sign),widgets); + g_signal_connect(G_OBJECT(widgets->SaveButton),"clicked",G_CALLBACK(on_save),widgets); + g_signal_connect(G_OBJECT(widgets->RepoTree),"cursor-changed",G_CALLBACK(on_tree_selection_changed),widgets); + g_signal_connect(G_OBJECT(widgets->Finder),"changed",G_CALLBACK(on_search),widgets); /* Localisation | Локализация */ - gtk_label_set_text(GTK_LABEL(widgets->HatLabel),TITLE_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->SaveLabel),SAVE_LABEL); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->SaveMenuItem),SAVE_CONFIGURATION_LABEL); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->SaveGlobalMenuItem),SAVE_GLOBAL_LABEL); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->SaveLocalMenuItem),SAVE_LOCAL_LABEL); - - gtk_label_set_text(GTK_LABEL(widgets->LoadLabel),LOAD_LABEL); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->LoadGlobalMenuItem),LOAD_GLOBAL_LABEL); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->LoadLocalMenuItem),LOAD_LOCAL_LABEL); - - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->DocumentationMenuItem),DOCUMENTATION_LABEL); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->AboutMenuItem),ABOUT_LABEL); - - - gtk_label_set_text(GTK_LABEL(widgets->GeneralTabLabel),GENERAL_TAB_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->PublicationTabLabel),PUBLICATION_TAB_LABEL); + gtk_widget_show(widgets->Window); - gtk_label_set_text(GTK_LABEL(widgets->CodeNameLabel),CODE_NAME_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->BranchLabel),BRANCH_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->VersionLabel),VERSION_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->ArchitectureLabel),ARCHITECRURE_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->ComponentsLabel),COMPONENTS_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->SignatureLabel),SIGNATURE_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->ServerTypeLabel),SERVER_TYPE_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->IpAdressLabel),IP_ADRESS_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->PortLabel),PORT_LABEL); - - gtk_button_set_label(GTK_BUTTON(widgets->TrustedRepoCheck),TRUSTED_LABEL); - - gtk_widget_set_tooltip_markup(widgets->CreateButton,CREATE_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->LoadFromNetButton,OPEN_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->ConfigureButton,CONFIGURE_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->DeleteButton,DELETE_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->LoadFromLocalButton,ADD_REMOVE_LOCAL_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->SwitchPublishButton,ENABLE_DISABLE_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->CheckDependencesButton,CHECK_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->SignButton,SIGN_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->AddPackageButton,ADD_PACKAGE_REPO_LABEL); - gtk_widget_set_tooltip_markup(widgets->RemovePackageButton,REMOVE_PACKAGE_REPO_LABEL); - gtk_widget_show_all(widgets->Window); return widgets; } @@ -254,7 +802,8 @@ int main(int argc, char *argv[]){ textdomain (LocaleName); config_init(); int option_index=0; - int show_help=0; + int show_help=0; + int debug_mode=0; { struct option long_options[] = { {"help", 0, 0, 'h'}, @@ -267,10 +816,11 @@ int main(int argc, char *argv[]){ {"socket-id", 1, 0, 's'}, {"socket-ext-id", 1,0, 'e'}, {"socket-trd-id", 1,0, 't'}, + {"debug", 0,0, 'd'}, { NULL, 0, NULL, 0 } }; for (int i=0;iHeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path); - - if (yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel)) - yon_ubl_status_box_render(TITLE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + yon_ubl_header_setup_resource(widgets->HeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path); + yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel); + yon_ubl_status_box_render(LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id); + yon_window_config_setup(GTK_WINDOW(widgets->Window)); + yon_window_config_load(config_path); + + /*Check for null config parameter | Проверка на отсутствующий в конфигурации параметр */ + GValue *val = g_malloc0(sizeof(GValue)); + g_object_get_property(G_OBJECT(widgets->MovePaned),"position",val); + int paned_size = g_value_get_int(val); + if (paned_size<100) + gtk_paned_set_position(GTK_PANED(widgets->MovePaned),400); + on_load(); + GtkTreeIter *iter = g_malloc0(sizeof(GtkTreeIter)); + if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(main_config.tree_store),iter)) + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),iter); GtkCssProvider *css=gtk_css_provider_new(); - gtk_css_provider_load_from_path(css,CssPath,NULL); + gtk_css_provider_load_from_resource(css,CssPath); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), - GTK_STYLE_PROVIDER(css), - -1); + GTK_STYLE_PROVIDER(css), + -1); gtk_main(); } \ No newline at end of file diff --git a/source/ubl-settings-repomanager.h b/source/ubl-settings-repomanager.h index ddf5c4a..5b94dc4 100644 --- a/source/ubl-settings-repomanager.h +++ b/source/ubl-settings-repomanager.h @@ -8,7 +8,9 @@ #include #include #include -#include "ubl-cmake.h" +#include +#include +#include "../compile/ubl-cmake.h" #ifdef WEBKIT_FOUND #include #endif @@ -18,18 +20,36 @@ #define _(String) gettext(String) -#define glade_path "/usr/share/ubl-settings-repomanager/ui/ubl-settings-repomanager.glade" -#define banner_path "/usr/share/ubl-settings-repomanager/images/ubl-settings-repomanager-banner.png" -#define CssPath "/usr/share/ubl-settings-repomanager/css/ubl-settings-repomanager.css" +#define glade_path "/com/ublinux/ui/ubl-settings-repomanager.glade" +#define glade_repo_path "/com/ublinux/ui/ubl-settings-repomanager-windows.glade" +#define glade_sign_path "/com/ublinux/ui/ubl-settings-repomanager-sign.glade" +#define banner_path "/com/ublinux/images/ubl-settings-repomanager-banner.png" +#define CssPath "/com/ublinux/css/ubl-settings-repomanager.css" +#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) +#define icon_path "com.ublinux.ubl-settings-repomanager" + +#define folder_no_edits "com.ublinux.ubl-settings-repomanager.folder-symbolic" +#define folder_deleted "com.ublinux.ubl-settings-repomanager.folder-red-symbolic" +#define folder_added "com.ublinux.ubl-settings-repomanager.folder-green-symbolic" +#define document_no_edits "com.ublinux.ubl-settings-repomanager.document-symbolic" +#define document_deleted "com.ublinux.ubl-settings-repomanager.document-red-symbolic" +#define document_added "com.ublinux.ubl-settings-repomanager.document-green-symbolic" #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-repomanager" typedef char* string; + +#define get_package_info_command(filename) yon_char_unite("LC_ALL=EN pacman -Q --info --file ",filename," ||sed -e 's/ */ /g' -e 's/ : /:/g' -e 's/\\n/ /g'",NULL) +#define get_saved_package_info_command(path,filename) yon_char_unite("LC_ALL=EN pacman -Q --info --file $(find \"",path,"\" -name *",filename,"* -not -name *.sig |head -n 1)|sed -e 's/ */ /g' -e 's/ : /:/g' -e 's/\\n/ /g'",NULL) + +#define get_gpg_keys_command yon_char_unite(yon_ubl_check_root()==1 ? yon_char_unite("su - ",yon_ubl_root_user_get()," -c \"gpg --list-signatures\"",NULL):"gpg --list-signatures"," | grep '^sig 3' | cut -d' ' -f10,11,13- | sort -u |sed -e 's/[0-9]*-[0-9]*-[0-9]* //g'",NULL) + string version_application; char *local; typedef struct { + GtkTreeStore *tree_store; int always_open_documentation; int win_pos_x; int win_pos_y; @@ -44,6 +64,7 @@ typedef struct { int lock_save_local; int lock_save_global; int lock_load_global; + int lock_root; } config; typedef struct { @@ -51,6 +72,8 @@ typedef struct { GtkWidget *HatLabel; GtkWidget *PlugBox; + GtkWidget *MovePaned; + GtkWidget *HeadOverlay; GtkWidget *HeadImage; GtkWidget *HeadBox; @@ -107,12 +130,40 @@ typedef struct { GtkWidget *ArchitectureLabel; GtkWidget *ArchitectureInfoLabel; GtkWidget *ComponentsLabel; - GtkWidget *ComponentsInfoLabel; + GtkWidget *DependencesInfoLabel; GtkWidget *SignatureLabel; GtkWidget *SignatureInfoLabel; GtkWidget *Finder; + GtkWidget *SaveButton; + GtkWidget *NameBox; + GtkWidget *VersionBox; + GtkWidget *ArchitectureBox; + GtkWidget *DependenceBox; + GtkWidget *SignatureBox; } main_window; +typedef struct { + GtkWidget *Window; + GtkWidget *NameEntry; + GtkWidget *BranchesTree; + GtkWidget *CancelButton; + GtkWidget *SaveButton; + GtkCellRenderer *BranchCell; + GtkWidget *repoChooseFolderButton; + + GtkListStore *BranchesListStore; + GtkWidget *PathLabel; + char *path; +} repo_create_window; + +typedef struct { + GtkWidget *Window; + GtkWidget *HeaderLabel; + GtkWidget *KeysCombo; + + GtkWidget *CloseButton; + GtkWidget *SaveButton; +} repo_sign_window; typedef struct { GtkWidget *Window; @@ -126,5 +177,15 @@ typedef struct { GtkWidget *AcceptButton; } documentation_confirmation_window; - -main_window *setup_window(); \ No newline at end of file +typedef enum { + YON_REPO_LINE_REPO_TYPE, + YON_REPO_LINE_FILE_TYPE, + YON_REPO_LINE_BRANCH_TYPE +} YON_REPO_LINE_TYPE; + +main_window *setup_window(); +void yon_add_file(main_window *widgets); +GtkTreeIter *yon_repo_append(main_window *widgets, char *name, YON_REPO_LINE_TYPE type); +void yon_repo_remove_package(main_window *widgets); +void yon_repo_remove(main_window *widgets); +void on_repo_configure_done(GtkWidget *self, dictionary *dict); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index cdea169..b7cd232 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -1,15 +1,20 @@ #define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL) #define HELP_LABEL yon_char_unite(_("ubl-settings-repomanager version:")," ", version_application,"\n",TITLE_LABEL,"\n",_("Usage:"), " ubl-settings-repomanager ",_("[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",NULL) +#define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked") + #define TITLE_LABEL _("Repository manager") #define TITLE_INFO_LABEL _("Repository management and configuring") +#define SUCCESS_LABEL _("Operation succeeded") #define ABOUT_LABEL _("About") #define DOCUMENTATION_LABEL _("Documentation") + #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 LOAD_LOCAL_LABEL _("Load local configuration") #define LOAD_GLOBAL_LABEL _("Load global configuration") #define LOAD_LABEL _("Load") @@ -23,13 +28,9 @@ #define PROJECT_HOME_LABEL _("Project Home Page") #define NOTHING_CHOSEN_LABEL _("Nothing were chosen") +#define LOAD_SUCCESS_LABEL _("Repository data has been loaded successfully") -#define GLOBAL_LOAD_SUCCESS _("Global configuration loading succseeded.") -#define LOCAL_LOAD_SUCCESS _("Local configuration loading succseeded.") - -#define GLOBAL_LOCAL_SAVE_SUCCESS _("Local and global configuration saving succseeded.") -#define GLOBAL_SAVE_SUCCESS _("Global configuration saving succseeded.") -#define LOCAL_SAVE_SUCCESS _("Local configuration saving succseeded.") +#define SAVE_SUCCESS_LABEL _("Saving has succseeded") #define GENERAL_TAB_LABEL _("General") #define PUBLICATION_TAB_LABEL _("Publication") @@ -43,6 +44,7 @@ #define ARCHITECRURE_LABEL _("Architecture:") #define COMPONENTS_LABEL _("Components:") #define SIGNATURE_LABEL _("Signature:") +#define SIGN_LABEL _("Sign") #define CREATE_REPO_LABEL _("Create repository") #define OPEN_REPO_LABEL _("Open existing repository") @@ -53,4 +55,29 @@ #define CHECK_REPO_LABEL _("Check dependences") #define SIGN_REPO_LABEL _("Sign ripository") #define ADD_PACKAGE_REPO_LABEL _("Add package") -#define REMOVE_PACKAGE_REPO_LABEL _("Remove package") \ No newline at end of file +#define REMOVE_PACKAGE_REPO_LABEL _("Remove package") +#define OPEN_LABEL _("Open") + +#define OPERATION_DONE_LABEL _("Operation done") + +#define CHOOSE_BRANCH_PACK_LABEL _("Choose branch or pack in branch to add file!") +#define CHOOSE_REPO_BRANCH_LABEL _("Choose repository or branch!") +#define CHOOSE_PACK_LABEL _("Choose pack to delete!") +#define CHOOSE_REPO_LABEL _("Choose repository to delete!") +#define SIGN_CHOOSE_LABEL _("Choose repository or package to sign") + +#define NAME_LABEL _("Name:") +#define BRANCHES_LABEL _("Branches:") +#define TYPE_BRANCH_NAME_LABEL _("< Type branch name >") +#define EMPTY_NAME_LABEL _("Name must be filled!") +#define CHOOSE_PATH_LABEL _("Choose path for new repository") + +#define ADD_REPO_LABEL _("Choose repository folder") +#define LOAD_REPO_LABEL _("Choose repository") + +#define ABSENT_LABEL _("Absent") +#define DEPENDENCE_LABEL _("Dependences:") +#define DIGITAL_SIGNATURE_LABEL _("Digital signature") + +#define PACKAGE_LABEL _("package") +#define REPOSITORY_LABEL _("repository") \ No newline at end of file diff --git a/source/ubl-utils.c b/source/ubl-utils.c index ec125cf..2403ef2 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -2,11 +2,13 @@ // dictionary functions -/**[EN] - * yon_dictionary_create_empty(): +/**yon_dictionary_new(): + * [EN] * Creates and returns empty dictionary + * [RU] + * Создаёт и возвращает пустой словарь. */ -dictionary *yon_dictionary_create_empty() +dictionary *yon_dictionary_new() { dictionary *dict = malloc(sizeof(dictionary)); dict->data = NULL; @@ -18,34 +20,133 @@ dictionary *yon_dictionary_create_empty() return dict; } +/**yon_dictionary_copy(dictionary *dict) + * [EN] + * + * [RU] + * Создаёт и возвращает копию элемента словаря [dict] +*/ +dictionary *yon_dictinoary_copy(dictionary *dict){ + dictionary *dct = yon_dictionary_new_with_data(dict->key,dict->data); + dct->data_type= dict->data_type; + return dct; +} + +/**yon_dictionary_copy_deep(dictionary *dict) + * [EN] + * + * [RU] + * Создаёт полную копию словаря [dict] и возвращает первый элемент +*/ +dictionary *yon_dictionary_copy_deep(dictionary *dict){ + dictionary *dct = NULL; + dictionary *newone=NULL; + for_dictionaries(dct,dict){ + yon_dictionary_add_or_create_if_exists_with_data(newone,dct->key,dct->data); + newone->data_type=dct->data_type; + } + return newone->first; +} + +/**int yon_dictionary_set_data(dictionary *dict, void *data) + * [EN] + * + * [RU] + * Установить элементу словаря [dict] значение [data] +*/ +int yon_dictionary_set_data(dictionary *dict, void *data){ + dict->data=data; +} + +/**int yon_dictionary_set_key(dictionary *dict, char *key) + * [EN] + * + * [RU] + * Изменяет ключ элемента словаря [dict] на [key] +*/ +int yon_dictionary_set_key(dictionary *dict, char *key){ + dict->key=key; + return 1; +} + +/** int yon_dictionary_set(dictionary *dict, char *key, void *data) + * [EN] + * + * [RU] +* Устанавливает значение ключа элемента словаря [dict] на [key] и его данные на [data] +*/ +int yon_dictionary_set(dictionary *dict, char *key, void *data){ + dict->key=key; + dict->data=data; + return 1; +} + +/**int yon_dictionary_empty(dictionary *dict) + * [EN] + * + * [RU] + * Очищает элемент словаря [dict] от данных +*/ +int yon_dictionary_empty(dictionary *dict){ + dict->data=NULL; + dict->data_type=DICTIONARY_OTHER_TYPE; + return 1; +} + +/**yon_dictionary_switch_to_last(dictionary **dict) + * [EN] + * + * [RU] + * Переключает словарь [dict] на последний элемент. +*/ void yon_dictionary_switch_to_last(dictionary **dict) { - if ((*dict)->next != NULL) - for ((*dict) = (*dict)->first; (*dict)->next != NULL; (*dict) = (*dict)->next) - { - } + dictionary *dct=NULL, *dact=*dict; + for_dictionaries(dct,dact); } -dictionary *yon_dictionary_create_conneced(dictionary *targetdict) +/**yon_dictionary_create_conneced(dictionary *targetdict) + * [EN] + * + * [RU] + * Создаёт новый элемент словаря [targetdict] +*/ +dictionary *yon_dictionary_append(dictionary *targetdict) { targetdict = yon_dictionary_get_last(targetdict); - targetdict->next = yon_dictionary_create_empty(); + targetdict->next = yon_dictionary_new(); targetdict->next->prev = targetdict; targetdict->next->first = targetdict->first; targetdict->next->data_type = DICTIONARY_OTHER_TYPE; return targetdict->next; } +/**yon_dictionary_get_last(dictionary *dict) + * [EN] + * + * [RU] + * Возвращает последний элемент словаря [dict]. + * В отличае от yon_dictionary_switch_to_last() + * словарь [dict] остаётся на прежнем элементе. +*/ dictionary *yon_dictionary_get_last(dictionary *dict) { - dictionary *dct = NULL; - for (dct = dict->first; dct->next != NULL; dct = dct->next) - { - } - return dct; + if (dict->next){ + dictionary *dct = NULL; + for_dictionaries(dct,dict); + return dct; + } else return dict; } -dictionary *yon_dictionary_switch_places(dictionary *dict, int aim) +/**yon_dictionary_switch_places(dictionary *dict, int aim) + * [EN] + * + * [RU] + * Меняет элемент словаря [dict] местами с другим элементом. + * если [aim]<0 элемент меняется местами с левым элементом; + * если [aim]>0 элемент меняется местами с правым элементом; +*/ +dictionary *yon_dictionary_swap(dictionary *dict, int aim) { if (aim < 0) { @@ -146,6 +247,13 @@ dictionary *yon_dictionary_switch_places(dictionary *dict, int aim) } } +/**yon_dictionary_make_first(dictionary *dict) + * [EN] + * + * [RU] + * Устанавливает указатель первого элемента словаря [dict] + * на текущий элемент. Не использовать. +*/ void yon_dictionary_make_first(dictionary *dict) { for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) @@ -154,6 +262,12 @@ void yon_dictionary_make_first(dictionary *dict) } } +/**yon_dictionary_make_nth(dictionary *dict, int nth) + * [EN] + * + * [RU] + * Перемещает элемент словаря [dict] на позицию [nth]. +*/ void yon_dictionary_make_nth(dictionary *dict, int nth) { dictionary *dct = dict->first; @@ -172,9 +286,15 @@ void yon_dictionary_make_nth(dictionary *dict, int nth) dct->prev = dict; } -dictionary *yon_dictionary_create_with_data(char *key, void *data) +/**yon_dictionary_create_with_data(char *key, void *data) + * [EN] + * + * [RU] + * Создаёт новый словарь с ключом [key] и указателем на данные [data] +*/ +dictionary *yon_dictionary_new_with_data(char *key, void *data) { - dictionary *dct = yon_dictionary_create_empty(); + dictionary *dct = yon_dictionary_new(); dct->key = yon_char_new(key); dct->data = data; dct->data_type = DICTIONARY_OTHER_TYPE; @@ -199,15 +319,28 @@ void *yon_dictionary_free_all(dictionary *dictionary_to_free,void (*data_manipul return NULL; } -dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data) +/**yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data) + * [EN] + * + * [RU] + * Создаёт новый элемент словаря, присоединяемый в конец словаря [dict] + * с ключом [key] и указателем на данные [data] +*/ +dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data) { - dictionary *dct = yon_dictionary_create_conneced(dict); + dictionary *dct = yon_dictionary_append(dict); dct->key = yon_char_new(key); dct->data = data; dct->data_type = DICTIONARY_OTHER_TYPE; return dct; } +/**yon_dictionary_connect(dictionary *old, dictionary *toconnect) + * [EN] + * + * [RU] + * Присоединяет словарь [toconnect] в конец словаря [old]. +*/ dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect) { dictionary *dict = yon_dictionary_get_last(old); @@ -217,7 +350,14 @@ dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect) return toconnect; } -dictionary *yon_dictionary_find(dictionary **dict, char *key) +/**yon_dictionary_get(dictionary **dict, char *key) + * [EN] + * + * [RU] + * Возвращает элемент словаря [dict] с ключом [key]. + * Если такого элемента не было обнаружено, возвращается NULL +*/ +dictionary *yon_dictionary_get(dictionary **dict, char *key) { dictionary *dct = *dict; for (dictionary *pointer = dct->first; pointer != NULL; pointer = pointer->next) @@ -231,6 +371,12 @@ dictionary *yon_dictionary_find(dictionary **dict, char *key) return NULL; } +/**yon_dictionary_rip(dictionary *dict) + * [EN] + * + * [RU] + * Вырезает элемент из словаря и возвращает вырезанный элемент. +*/ dictionary *yon_dictionary_rip(dictionary *dict) { if (!dict->next&&!dict->prev) return NULL; @@ -266,6 +412,12 @@ dictionary *yon_dictionary_rip(dictionary *dict) } } +/**yon_dictionary_get_nth(dictionary *dict, int place) + * [EN] + * + * [RU] + * Возвращает [place]-й элемент словаря [dict] +*/ dictionary *yon_dictionary_get_nth(dictionary *dict, int place) { if (dict){ @@ -285,11 +437,18 @@ dictionary *yon_dictionary_get_nth(dictionary *dict, int place) // char functions +int yon_char_find_last(char *source, char find){ + int size = strlen(source); + int i=size; + for (;source[i]!=find&&i>0;i--); + return i; +} + /**[EN] * * creates new char string by combining two char strings. */ -char *yon_char_get_augumented(char *source, char *append) +char *yon_char_append(char *source, char *append) { if (source && append) { @@ -321,8 +480,12 @@ char *yon_char_new(char *chr) return NULL; } -// char *yon_char_unite(char *source, ...) - +/**yon_char_unite(char *source, ...) + * [En] + * + * [RU] + * Объединяет строку [source] со всеми строками, написанными в [...] +*/ char *yon_char_unite(char *source, ...){ va_list arglist; char *new_char=NULL; @@ -331,15 +494,15 @@ char *yon_char_unite(char *source, ...){ va_start(arglist,source); unite_char = va_arg(arglist,char*); while(unite_char){ - new_char = yon_char_get_augumented(new_char,unite_char); + new_char = yon_char_append(new_char,unite_char); unite_char = va_arg(arglist,char*); } va_end(arglist); return new_char; } -/**[EN] - * +/**yon_cut(char *source, int size, int startpos) + * [EN] * cuts source string by size length from startpos position. */ char *yon_cut(char *source, int size, int startpos) @@ -350,8 +513,9 @@ char *yon_cut(char *source, int size, int startpos) memcpy(cut, source + startpos, size); return cut; } -/**[EN] - * + +/**yon_char_divide(char *source, int dividepos) + * [EN] * divides source string in dividepos position, * returning left part of divided string and * inserting right part to source string. @@ -369,6 +533,12 @@ char *yon_char_divide(char *source, int dividepos) return cut; } +/**yon_char_find_count(char *source, char *find) + * [EN] + * + * [RU] + * Считает количество символов [find] в строке [source] +*/ int yon_char_find_count(char *source, char *find){ char *working_string=yon_char_new(source); int i=0; @@ -383,7 +553,8 @@ int yon_char_find_count(char *source, char *find){ return i; } -/**[EN] +/**yon_char_divide_search(char *source, char *dividepos, int delete_divider) + * [EN] * char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) * searches string [dividepos] in [source] string and divides it, * returning left part of divided string and @@ -410,12 +581,12 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) cut = yon_char_divide(source, leng); return cut; } - else - return source; } + return source; } -/**[EN] +/**yon_char_from_int(int int_to_convert) + * [EN] * char *yon_char_from_int(int int_to_convert) * converts int to char*. * @@ -427,32 +598,43 @@ char *yon_char_from_int(int int_to_convert) { int i = 1; float convert_check = (float)int_to_convert; - for (i = 1; convert_check > 10; i++) + for (i = 1; convert_check >= 10; i++) { convert_check = convert_check / 10; } - char *ch = malloc(i * sizeof(char) + 1); + char *ch = g_malloc0(i * sizeof(char) + 1); sprintf(ch, "%d", int_to_convert); return ch; } -char *yon_char_replace(char *source, char *find, char*replace){ - char *final=NULL; - char *temp=NULL; - if(!strstr(replace,find)){ - while ((final=strstr(source,find))){ - temp=malloc(strlen(source)-strlen(final)); - memset(temp,0,strlen(source)-strlen(final)+strlen(replace)); - memcpy(temp,source,strlen(source)-strlen(final)); - temp=yon_char_get_augumented(temp,replace); - source=yon_char_get_augumented(temp,final+1); +/**yon_char_replace(char *source, char *find, char*replace) + * [EN] + * + * [RU] + * Заменяет в строке [source] все вхождения строки [find] на [replace] +*/ +char *yon_char_replace(char *source, char *find, char*replace){ + if (!strstr(replace,find)){ + + + char *final=NULL; + char *temp=NULL; + if(!strstr(replace,find)){ + while ((final=strstr(source,find))){ + temp=malloc(strlen(source)-strlen(final)); + memset(temp,0,strlen(source)-strlen(final)+strlen(replace)); + memcpy(temp,source,strlen(source)-strlen(final)); + temp=yon_char_append(temp,replace); + source=yon_char_append(temp,final+1); + } + } - return source; } + return source; } -/**[EN] - * char **yon_char_parse(char *parameters, int *size, char *divider) +/**yon_char_parse(char *parameters, int *size, char *divider) + * [EN] * Parses string [parameters], divided by [divider], * then returns parsed string array and sets [size] to * size of returned array @@ -463,52 +645,73 @@ char **yon_char_parse(char *parameters, int *size, char *divider){ string=malloc(sizeof(char*)); char *paramline=yon_char_new(parameters); char *param; + if (!strstr(parameters,divider)) return NULL; while ((param=yon_char_divide_search(paramline,divider,1))){ + if (strcmp(param,paramline)==0||param[0]=='\0') break; string=realloc(string,sizeof(char*)*i); string[i-1]=yon_char_new(param); i++; - if (strcmp(param,paramline)==0) break; } string=realloc(string,sizeof(char*)*i); string[i-1]=yon_char_new(paramline); i++; - // printf("%d\n",i); *size=i-1; return string; - } -char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete){ +/**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete) + * [EN] + * + * [RU] + * Удаляет элемент [item_to_delete] из массива строк [char_string], размера [size] + * Возвращает получившийся массив, в [size] загружается размер нового массива. +*/ +char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete){ char **new_char_parsed=NULL; - new_char_parsed=malloc(sizeof(char*)*(*size)-2); - int sz=0; - for (int i=0;i<*size-2;i++){ - if (i!=item_to_delete){ + new_char_parsed=malloc(sizeof(char*)*((*size)-1)); + int flag = 0; + for (int i=0;i < (*size);i++){ + if (i==item_to_delete) { + flag = 1; + } + if (flag == 0) { new_char_parsed[i]=yon_char_new(char_string[i]); - sz++; } - + else if (flag == 1 && i!=item_to_delete) { + new_char_parsed[i-1]=yon_char_new(char_string[i]); + } } - *size=sz; + (*size)=(*size)-1; return new_char_parsed; } -/**[EN] - * +/**yon_char_parsed_check_exist(char **parameters, int size, char *param) + * [EN] * Checks if [parameters] string array of length [size] * has [param] element; + * [RU] + * Проверяет есть ли в массиве строк [parameters], размера [size] + * элемент [param] */ int yon_char_parsed_check_exist(char **parameters, int size, char *param){ for (int i=0;id_name); + char *path = yon_char_append(DesktopPath, de->d_name); file = fopen(path, "r"); if (strlen(de->d_name) > 9) { @@ -664,15 +941,197 @@ apps *yon_apps_get_by_name(apps *applist, char *name, int size) return NULL; }; -config_str yon_config_load(char *command, int *str_len) -{ +//config functions + +/**yon_config_load_register(char *command) + * [EN] + * + * [RU] + * Выполняет команду [command]. + * Полученные данные парсятся и регистрируются в конфиг. +*/ +int yon_config_load_register(char *command){ + if (__yon__config__strings){ + __yon__config__strings = yon_dictionary_free_all(__yon__config__strings,NULL); + } + FILE *output = popen(command, "r"); + char **output_strings = NULL; + output_strings = malloc(sizeof(char)); + int i = 0; + char str[4096]; + memset(str, 0, 4096); + while (fgets(str, 4096, output)) + { + if (strcmp(str, "") != 0&& strcmp(str,"(null)\n")!=0) + { + char *key = yon_char_divide_search(str,"=",-1); + yon_dictionary_add_or_create_if_exists_with_data(__yon__config__strings,key,str); + __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE; + } + } + check_config + return 0; + else return 1; +} + +/**yon_config_remove_by_key(char *key) + * [EN] + * + * [RU] + * Удаляет параметр конфига по ключу [key] +*/ +int yon_config_remove_by_key(char *key){ + check_config{ + dictionary *dict = yon_dictionary_get(&__yon__config__strings,key); + if (dict){ + yon_dictionary_rip(dict); + return 1; + }else return 0; + } + return 0; +} + +/**yon_config_remove_by_data(void *data) + * [EN] + * + * [RU] + * Производит поиск по конфигу на наличие параметра со значением [data] и удаляет найденное значение из конфига. +*/ +int yon_config_remove_by_data(void *data){ + check_config{ + dictionary *dict = NULL; + for_dictionaries(dict,__yon__config__strings){ + if (dict->data==data){ + yon_dictionary_rip(dict); + return 1; + } + } + return 0; + } + return 0; +} + +/**yon_config_remove_element(char *key, char *deleted) + * [EN] + * + * [RU] + * Удаляет элемент [deleted] из массива параметров с ключом [key] +*/ +int yon_config_remove_element(char *key, char *deleted){ + check_config{ + dictionary *dict = yon_dictionary_get(&__yon__config__strings,key); + char *data = (char*)dict->data; + char *found = strstr(data,deleted); + int size=strlen(data)-strlen(found)+1; + char *new_data = malloc(size); + memset(new_data,0,size); + if (strlen(found)!=strlen(deleted)){ + memcpy(new_data,data,size-1); + new_data = yon_char_append(new_data,found+strlen(deleted)+1); + } else { + memcpy(new_data,data,size-2); + new_data = yon_char_append(new_data,found+strlen(deleted)); + } + dict->data=(void*)(new_data); + free(data); + dict->flag1=1; + return 1; + } else return 0; +} + +/**yon_config_get_by_key(char *key) + * [EN] + * + * [RU] + * Возвращает значение параметра конфига с ключом [key] +*/ +void *yon_config_get_by_key(char *key){ + check_config{ + dictionary *dict = NULL; + for_dictionaries(dict, __yon__config__strings){ + if (strcmp(dict->key,key)==0){ + return dict->data; + } + } + } + return NULL; +} + +/**yon_config_get_key_by_data(char *data) + * [EN] + * + * [RU] + * Возвращает ключ параметра конфига со значением [data]. + * Если параметр с таким значением не найден, возвращается NULL +*/ +char *yon_config_get_key_by_data(char *data){ + check_config{ + dictionary *dict = NULL; + for_dictionaries(dict, __yon__config__strings){ + if (strcmp(((char*)dict->data),data)==0){ + return dict->key; + } + } + } + return NULL; +} + +/**yon_config_set(char *key, void *data) + * [EN] + * + * [RU] + * Производит поиск по конфигу и заменяет значение параметра с ключом [key] на новое значение [data]; +*/ +int yon_config_set(char *key, void *data){ + check_config{ + dictionary *dict = yon_dictionary_get(&__yon__config__strings,key); + dict->data=data; + return 1; + } else return 0; +} + +/**yon_config_clean() + * [EN] + * Erase all parameters from config; + * [RU] + * Удаляет все параметры из конфига; +*/ +int yon_config_clean(){ + check_config{ + __yon__config__strings = yon_dictionary_free_all(__yon__config__strings, NULL); + return 1; + } + else return 0; +} + +/**yon_config_register(char *key, void *data) + * [EN] + * + * [RU] + * Регистрирует новый параметр конфига. + * [key] - ключ параметра; + * [data] - значение параметра; +*/ +void yon_config_register(char *key, void *data){ + yon_dictionary_add_or_create_if_exists_with_data(__yon__config__strings,key,data); + __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE; +} + +/**yon_config_load(char *command, int *str_len) + * [EN] + * + * [RU] + * Выполняет команду [command] и возвращает распаршеный результат выполнения команды. + * В [str_len] возвращается длина возвращаемого массива +*/ +config_str yon_config_load(char *command, int *str_len){ FILE *output = popen(command, "r"); char **output_strings = NULL; output_strings = malloc(sizeof(char)); int i = 0; - char str[1000]; - memset(str, 0, 1000); - while (fgets(str, 1000, output)) + char str[4096]; + memset(str, 0, 4096); + while (fgets(str, 4096, output)) { if (strcmp(str, "") != 0) { @@ -680,7 +1139,7 @@ config_str yon_config_load(char *command, int *str_len) // printf("%s\n", str); output_strings[i] = NULL; output_strings[i] = yon_char_new(str); - memset(str, 0, 1000); + memset(str, 0, 4096); i++; } } @@ -693,22 +1152,54 @@ config_str yon_config_load(char *command, int *str_len) } } -/**[EN] - * int yon_config_save(char *command) +/**int yon_config_save(char *command) + * [EN] * Saves config with [command] * [RU] + * Выполняет команду [command], добавляя в конец все записи конфига в таком виде: + * [ПАРАМЕТР1]="[значения1]" [ПАРАМЕТР2]="[значения2]" */ -int yon_config_save(char *command) -{ - FILE *output = popen(command, "r"); - return 1; +int yon_config_save_registered(char *command){ + check_config{ + dictionary *dict = NULL; + for_dictionaries(dict,__yon__config__strings){ + command = yon_char_unite(command, " ", yon_dictionary_get_data(dict,char*), NULL); + } + if (popen(command, "r")) return 1; + else return 0; + } else return 0; } -/**[EN] - * char *yon_config_get_parameter(config parameters, int size, char *param) - * Gets parameter from parameter list; +/**yon_config_get_all(int *size) + * [EN] * + * [RU] + * Возвращает массив со всеми параметрами конфига, оканчивающаяся NULL + * [size] - указатель, в который выгружается длина массива +*/ +config_str yon_config_get_all(int *size){ + check_config{ + *size = 1; + config_str conf = NULL; + dictionary *dict = NULL; + for_dictionaries(dict,__yon__config__strings){ + conf = yon_remalloc(conf,sizeof(char*)*(*size)); + conf[(*size)-1] = yon_char_unite(dict->key,"=",(char*)dict->data,NULL); + size++; + } + conf = yon_remalloc(conf,sizeof(char*)*(*size+1)); + conf[*size] = NULL; + return conf; + } else return NULL; +} + +/**char *yon_config_get_parameter(config parameters, int size, char *param) + * [EN] + * Gets parameter [param] from parameter list [parameters] of size [size]; + * or NULL if nothing were found * [RU] + * Возвращает параметр [param] из массива строк [parameters] размером [size] + * или NULL если такой не был найден */ char *yon_config_get_parameter(config_str parameters, int size, char *param) { @@ -735,66 +1226,34 @@ char *yon_config_get_parameter(config_str parameters, int size, char *param) return NULL; } -/**[EN] - * Parses, modifies and connects string to use it as one of arguments, - * sended to ubconfig. - * - * [RU] - */ -char *yon_config_make_save_parameter_with_multiple_arguments(char *parameter_string, char *config_parameter, char *divider){ - char *final=""; - int done=0; - char *cur=yon_char_new(parameter_string); - yon_char_divide_search(cur,"=",1); - char *cur_param=NULL; - while (cur_param=yon_char_divide_search(cur,",",1)){ - if (done==0){ - final=yon_char_get_augumented(final,yon_char_get_augumented(yon_char_get_augumented(config_parameter,"="), yon_char_get_augumented(cur_param,", "))); - done=1; - } else { - final=yon_char_get_augumented(final,yon_char_get_augumented(yon_char_get_augumented(config_parameter,"+="), yon_char_get_augumented(cur_param,", "))); - } - } - if (cur&&strcmp(cur,"")!=0) - if (done==0) - final=yon_char_get_augumented(final,yon_char_get_augumented(yon_char_get_augumented(config_parameter,"="), yon_char_get_augumented(cur,", "))); - else - final=yon_char_get_augumented(final,yon_char_get_augumented(yon_char_get_augumented(config_parameter,"+="), yon_char_get_augumented(cur,", "))); - return final; -} -// terminal-using functions -int yon_launch_app(char *name) -{ - char *path = name; - thread_output *thread = malloc(sizeof(thread_output)); - thread->command = path; - thread->exitcode = malloc(sizeof(int)); - pthread_t thread_id; - pthread_create(&thread_id, NULL, (void *)yon_launch, thread); - return *thread->exitcode; -}; +// terminal-using functions +/**yon_launch_app_with_arguments(char *name, char *args) + * [EN] + * Execute [command] in separate thread; + * [RU] + * Выполнить команду [command] в отдельном потоке; +*/ int yon_launch_app_with_arguments(char *name, char *args) { - char *path = yon_char_get_augumented("/usr/bin/", name); - path = yon_char_get_augumented(path, " "); - path = yon_char_get_augumented(path, args); + char *path = yon_char_unite("/usr/bin/", name, " ", args,NULL); pthread_t thread_id; - thread_output *thread = malloc(sizeof(thread_output)); - thread->command = path; - thread->exitcode = malloc(sizeof(int)); - pthread_create(&thread_id, NULL, (void *)yon_launch, thread); - return *thread->exitcode; + char *command = NULL; + command = path; + pthread_create(&thread_id, NULL, (void *)yon_launch, command); }; -int yon_launch(thread_output *thread) +/**yon_launch(char *command) + * [EN] + * Execute command [command] + * [RU] + * Выполнить команду [command] +*/ +void yon_launch(char *command) { - int a = 0; - a = system(thread->command); - *thread->exitcode = a; - return *thread->exitcode; + system(command); } // Gtk functions @@ -807,6 +1266,13 @@ static render_data render; #ifdef VTE_TERMINAL +static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data) +{ + if (!terminal) return; + if (pid == -1) printf("Error\n\n\n"); + else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data)); +} + /** * void yon_terminal_integrated_launch(GtkWidget *place_to_show, void *endwork_function, void* endwork_function_argument) * [EN] @@ -819,27 +1285,37 @@ static render_data render; * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. */ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument){ + char **commands=new_arr(char*,2); + gchar **envp = g_get_environ(); + commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL")); + commands[1]=NULL; + char **env=new_arr(char*,2); + env[0]=""; + env[1]=NULL; GtkWidget *terminal = vte_terminal_new(); vte_terminal_set_size(VTE_TERMINAL(terminal),10,15); VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); + gtk_container_add(GTK_CONTAINER(place_to_show),terminal); char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); - g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(on_terminal_done), widgets); + printf("%s\n",install_command); + if(endwork_function) + g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); vte_terminal_spawn_async(VTE_TERMINAL(terminal), VTE_PTY_DEFAULT, NULL, - install_command, + commands, NULL, 0, NULL, NULL, NULL, -1, NULL, - NULL, - NULL); + child_ready, + install_command); vte_pty_spawn_async(pty, NULL, - install_command, + commands, NULL, 0, NULL, NULL, @@ -848,15 +1324,359 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi NULL, NULL, NULL); - vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), 100); + vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), -1); vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE); vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE); - gtk_widget_show_all(widgets->TerminalRevealer); + gtk_widget_show_all(terminal); } +/**yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument) + * [EN] + * launches terminal with specific [command], + * terminal is shown in [place_to_show] container, + * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument. + * [RU] + * Запускает терминал с командой [command], + * терминал добавляется в контейнер [place_to_show] виджета, + * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. +*/ +void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument){ + char **commands=new_arr(char*,2); + gchar **envp = g_get_environ(); + commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL")); + commands[1]=NULL; + char **env=new_arr(char*,2); + env[0]=""; + env[1]=NULL; + vte_terminal_set_size(VTE_TERMINAL(terminal),10,15); + VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); + vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); + char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); + if(endwork_function) + g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); + vte_terminal_spawn_async(VTE_TERMINAL(terminal), + VTE_PTY_DEFAULT, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + child_ready, + install_command); + vte_pty_spawn_async(pty, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + NULL, + NULL); + vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), 100); + vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE); + vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE); + gtk_widget_show_all(terminal); + } #endif -int yon_gtk_combo_box_fill(GtkWidget *combo, config_str parameters,int size){ + // Window config functions + + #define check_window_config_setup if(__yon_window_config_target_window) + + typedef struct { + char *parameter_name; + enum YON_TYPE containing_type; + GtkWidget *track_widget; + char *property_name; + } __yon_listener_parameter; + + typedef struct { + char *parameter_name; + char *section; + enum YON_TYPE containing_type; + void *property; + } __yon_custom_parameter; + + struct { + int x; + int y; + int width; + int height; + int fullscreen; + dictionary *custom_listeners; + dictionary *custom_parameters; + dictionary *deleted_parameters; + } __yon_main_window_config; + + static GtkWindow *__yon_window_config_target_window = NULL; + static GKeyFile *__yon_window_config_file = NULL; + static char *__yon_window_config_path = NULL; + + void yon_window_config_save(){ + g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x); + g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y); + g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width); + g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height); + g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen); + dictionary *dict=NULL; + if (__yon_main_window_config.custom_listeners) + for_dictionaries(dict,__yon_main_window_config.custom_listeners){ + __yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*); + GValue *val = g_malloc0(sizeof(GValue)); + g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val); + switch(param->containing_type){ + case YON_TYPE_STRING: + g_key_file_set_string(__yon_window_config_file,"window",param->parameter_name, g_value_get_string(val)); + break; + case YON_TYPE_INT: + g_key_file_set_integer(__yon_window_config_file,"window",param->parameter_name, g_value_get_int(val)); + break; + case YON_TYPE_BOOLEAN: + g_key_file_set_boolean(__yon_window_config_file,"window",param->parameter_name, g_value_get_boolean(val)); + break; + case YON_TYPE_OTHER:printf("\033[0;31mCannot save %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break; + } + } + if (__yon_main_window_config.custom_parameters) + for_dictionaries(dict,__yon_main_window_config.custom_parameters){ + __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); + switch (param->containing_type){ + case YON_TYPE_STRING: + g_key_file_set_string(__yon_window_config_file,param->section,param->parameter_name, (char*)param->property); + break; + case YON_TYPE_INT: + g_key_file_set_integer(__yon_window_config_file,param->section,param->parameter_name, *(int*)param->property); + break; + case YON_TYPE_BOOLEAN: + g_key_file_set_boolean(__yon_window_config_file,param->section,param->parameter_name, *(gboolean*)param->property); + break; + default: + break; + } + } + if (__yon_main_window_config.deleted_parameters) + for_dictionaries(dict,__yon_main_window_config.deleted_parameters){ + __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); + g_key_file_remove_key(__yon_window_config_file,param->section,param->parameter_name,NULL); + } + g_key_file_save_to_file(__yon_window_config_file,__yon_window_config_path,NULL); + } + + void yon_get_is_fullscreen(){ + gtk_window_is_maximized(__yon_window_config_target_window); + __yon_main_window_config.fullscreen = gtk_window_is_maximized(__yon_window_config_target_window); + if (!__yon_main_window_config.fullscreen) gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y); + } + + /**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event) + * [EN] + * + * [RU] + * Сохраняет настройки основного окна. Вызывается когда основное окно уничтожается. + */ + void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event){ + check_window_config_setup{ + yon_get_is_fullscreen(); + yon_window_config_save(); + } + gtk_main_quit(); + } + + void __yon_window_config_on_resize(){ + int max=0; + max=gtk_window_is_maximized(__yon_window_config_target_window); + if(max==0){ + gtk_window_get_size(__yon_window_config_target_window,&__yon_main_window_config.width,&__yon_main_window_config.height); + gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y); + } + } + + /**yon_window_config_setup(GtkWindow *window) + * [EN] + * + * [RU] + * Устанавливает указатель на окно для отслеживания его положения и размера + */ + void yon_window_config_setup(GtkWindow *window){ + __yon_window_config_target_window = window; + g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(yon_on_configured_window_destroy),NULL); + g_signal_connect(G_OBJECT(window),"check-resize"/*"configure-event"*/,G_CALLBACK(__yon_window_config_on_resize),NULL); + } + + void _yon_maximize(void *data){ + g_usleep(G_USEC_PER_SEC/10); + if(__yon_main_window_config.fullscreen ==1) gtk_window_maximize(__yon_window_config_target_window); + } + + /**yon_window_config_load(char *path) + * [EN] + * + * [RU] + * Загружает конфиг окна и инициализирует отслеживание его параметров + */ + int yon_window_config_load(char *path){ + __yon_window_config_file = g_key_file_new(); + __yon_window_config_path=yon_char_new(path); + if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){ + struct stat st; + int size; + char *path = yon_char_divide(yon_char_new(__yon_window_config_path),yon_char_find_last(__yon_window_config_path,'/')); + if (stat(path, &st) == -1) { + mkdir(path, 0777); + } + FILE *fp; + fp=fopen(__yon_window_config_path,"w"); + fclose(fp); + g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL); + } + __yon_main_window_config.x = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosX",NULL); + __yon_main_window_config.y = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosY",NULL); + __yon_main_window_config.width = g_key_file_get_integer(__yon_window_config_file,"window","WindowWidth",NULL); + __yon_main_window_config.height = g_key_file_get_integer(__yon_window_config_file,"window","WindowHeight",NULL); + __yon_main_window_config.fullscreen = g_key_file_get_integer(__yon_window_config_file,"window","fullscreen",NULL); + dictionary *dict=NULL; + if (__yon_main_window_config.custom_listeners) + for_dictionaries(dict,__yon_main_window_config.custom_listeners){ + __yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*); + GValue *val = g_malloc0(sizeof(GValue)); + g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val); + switch(param->containing_type){ + case YON_TYPE_STRING: + g_value_set_string(val,g_key_file_get_string(__yon_window_config_file,"window",param->parameter_name, NULL)); + break; + case YON_TYPE_INT: + g_value_set_int(val,g_key_file_get_integer(__yon_window_config_file,"window",param->parameter_name, NULL)); + break; + case YON_TYPE_BOOLEAN: + gboolean res = g_key_file_get_boolean(__yon_window_config_file,"window",param->parameter_name, NULL); + g_value_set_boolean(val,res); + break; + default:printf("\033[0;31mCannot load %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break; + } + g_object_set_property(G_OBJECT(param->track_widget),param->property_name,val); + } + if (__yon_main_window_config.width==0) __yon_main_window_config.width=800; + if (__yon_main_window_config.height==0) __yon_main_window_config.height=600; + gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height); + gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y); + pthread_t tid; + pthread_create(&tid,NULL,(void *)_yon_maximize,NULL); + return 1; + } + + void yon_window_config_apply(){ + dictionary *dict=NULL; + gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y); + gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height); + } + + config_str yon_window_config_get_section(char *section, gsize *size){ + config_str key = g_key_file_get_keys(__yon_window_config_file,section,size,NULL); + return key; + } + + /**yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type) + * [EN] + * + * [RU] + * Добавляет параметр виджета [widget] по названию [widget_property] для отслеживания и сохраняет его в конфиг под ключом [param_name]. + */ + void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type){ + __yon_listener_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_listener_parameter)); + param->parameter_name = yon_char_new(param_name); + param->track_widget = widget; + param->property_name = yon_char_new(widget_property); + param->containing_type = val_type; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.custom_listeners,param->parameter_name,param); + } + + void yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type){ + __yon_custom_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_custom_parameter)); + param->parameter_name = yon_char_new(param_name); + param->section=section; + param->property = tracked_value; + param->containing_type = val_type; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.custom_parameters,param->parameter_name,param); + } + + void yon_window_config_erase_custom_parameter(char *param_name, char *section){ + __yon_custom_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_custom_parameter)); + param->parameter_name=param_name; + param->section=section; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.deleted_parameters,param->parameter_name,param); + } + + int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type){ + GError *err=NULL; + switch (type){ + case YON_TYPE_BOOLEAN: + *((int*)return_value) = g_key_file_get_boolean(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_INT: + *((int*)return_value) = g_key_file_get_integer(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_STRING: + *((char**)return_value) = g_key_file_get_string(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_STRING_LIST: + gsize size=0; + *((char***)return_value) = g_key_file_get_string_list(__yon_window_config_file,section,config_parameter,&size,&err); + *((char***)return_value)=yon_remalloc(return_value,size+1); + *((char***)return_value)[size]=NULL; + if (err) return 0; else return 1; + break; + } + } + +GtkWidget *yon_ubl_menu_item_about_new(char *buttonname){ + GtkWidget *menu_item = gtk_menu_item_new(); + gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitembottom"); + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + GtkWidget *label = gtk_label_new(buttonname); + GtkWidget *image = gtk_image_new_from_icon_name("dialog-information-symbolic",GTK_ICON_SIZE_BUTTON); + gtk_label_set_xalign(GTK_LABEL(label),0.0); + gtk_box_pack_start(GTK_BOX(box),image,0,0,5); + gtk_box_pack_start(GTK_BOX(box),label,0,0,5); + gtk_container_add(GTK_CONTAINER(menu_item),box); + gtk_widget_show_all(menu_item); + return menu_item; +} + +GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname){ + GtkWidget *menu_item = gtk_menu_item_new(); + gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitemtop"); + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + GtkWidget *label = gtk_label_new(buttonname); + GtkWidget *image = gtk_image_new_from_icon_name("dialog-question-symbolic",GTK_ICON_SIZE_BUTTON); + gtk_label_set_xalign(GTK_LABEL(label),0.0); + gtk_box_pack_start(GTK_BOX(box),image,0,0,5); + gtk_box_pack_start(GTK_BOX(box),label,0,0,5); + gtk_container_add(GTK_CONTAINER(menu_item),box); + gtk_widget_show_all(menu_item); + return menu_item; +} + + +// other Gtk functions + +/**yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size) + * [EN] + * + * [RU] + * Добавляет в Комбобокс [combo] все строки из массива строк [parameters] размера [size] +*/ +int yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size){ if (combo&¶meters){ for (int i=0;ifirst; dct != NULL; dct = dct->next) - { - gtk_box_pack_start(GTK_BOX(destination), (GtkWidget *)dct->data, expand, fill, padding); +/**yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...) + * [EN] + * + * [RU] + * Добвляет [destination] все виджеты, прописанные после [padding]. Добавление происходит с начала контейнера. + * [expand] - расширяемость выделенного для виджетов места + * [fill] - заполнять ли виджетом всё ему выделенное место + * [padding] - отступ од других элементов +*/ +int yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...){ + va_list args; + va_start(args,padding); + GtkWidget *widget = va_arg(args,GtkWidget*); + while (widget){ + gtk_box_pack_start(GTK_BOX(destination), widget, expand, fill, padding); } + va_end(args); return 1; - }else return 0; } -int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding) -{ - for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) - { - gtk_box_pack_end(GTK_BOX(destination), (GtkWidget *)dct->data, expand, fill, padding); - } +/**yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...) + * [EN] + * + * [RU] + * Добвляет в [destination] все виджеты, прописанные после [padding]. Добавление происходит с конца контейнера. + * [expand] - расширяемость выделенного для виджетов места + * [fill] - заполнять ли виджетом всё ему выделенное место + * [padding] - отступ од других элементов +*/ +int yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...){ + va_list args; + va_start(args,padding); + GtkWidget *widget = va_arg(args,GtkWidget*); + while (widget){ + gtk_box_pack_end(GTK_BOX(destination), widget, expand, fill, padding); + } + va_end(args); return 1; } + void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path) { gtk_overlay_add_overlay(GTK_OVERLAY(Overlay), Head); gtk_image_set_from_file(GTK_IMAGE(Image), image_path); } +void _yon_ubl_header_setup_resource(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path) +{ + gtk_overlay_add_overlay(GTK_OVERLAY(Overlay), Head); + gtk_image_set_from_resource(GTK_IMAGE(Image), image_path); +} + int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label) { if(icon&&box&&label){ @@ -915,9 +1769,6 @@ int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label) } else return 0; } -/** - * -*/ void _yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type) { render_data data = render; @@ -944,7 +1795,6 @@ void _yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type) gtk_label_set_text(GTK_LABEL(data.label), text); } - void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type){ _yon_ubl_status_box_render(text,type); } diff --git a/source/ubl-utils.h b/source/ubl-utils.h index 8de7531..6ef2559 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -7,11 +7,15 @@ #include #include #include +#include +#include +#include +#include #include #include #include -#include "ubl-cmake.h" +#include "../compile/ubl-cmake.h" #ifdef WEBKIT_FOUND #include #endif @@ -22,29 +26,20 @@ #define new(type) malloc(sizeof(type)) #define new_arr(type,size) malloc(sizeof(type)*size) -#define yon_ubl_set_config_save_data_pointer(command) config_commands.config_save_data = command - -#define yon_ubl_load_global_config(command, size_pointer) yon_config_load(command, size_pointer) -#define yon_ubl_load_local_config(command, size_pointer) yon_config_load(command, size_pointer) -#define yon_ubl_save_global_config(command) yon_config_save(command) -#define yon_ubl_save_local_config(command) yon_config_save(command) +#define get_home_dir_command yon_char_unite("getent passwd \"",yon_ubl_root_user_get(),"\" | cut -d: -f6",NULL) typedef enum { #ifdef __GTK_H__ DICTIONARY_GTK_WIDGETS_TYPE, #endif - DICTIONARY_OTHER_TYPE + DICTIONARY_OTHER_TYPE=0, + DICTIONARY_CHAR_TYPE, + DICTIONARY_INT_TYPE, + DICTIONARY_BOOL_TYPE, } DICT_TYPE; -typedef struct -{ - char *command; - int *exitcode; -} thread_output; - - typedef struct dictionary { char *key; @@ -53,6 +48,7 @@ typedef struct dictionary struct dictionary *prev; struct dictionary *first; DICT_TYPE data_type; + int flag1; } dictionary; typedef struct apps @@ -67,6 +63,15 @@ typedef struct apps } apps; typedef char** config_str; + +static dictionary *__yon__config__strings = NULL; +#define check_config if(__yon__config__strings&&__yon__config__strings->data_type==DICTIONARY_CHAR_TYPE) + +#define config(key) yon_config_get_by_key(key) + +#define for_config dictionary temp = NULL; for_dictionary(temp,__yon__config__strings) + +#define yon_remalloc(pointer, size) (!pointer) ? malloc(size) : realloc(pointer, size) // dictionary functions /**yon_dictionary_get_data(dictionary, type) @@ -80,28 +85,36 @@ typedef char** config_str; * [type] - тип данных, хранящихся в словаре [dictionary]. */ #define yon_dictionary_get_data(dictionary, type) ((type)dictionary->data) -#define yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) {if (!dict) dict=yon_dictionary_create_with_data(key,data); \ - else dict=yon_dictionary_create_with_data_connected(dict,key,data);} -dictionary *yon_dictionary_create_empty(); +/**yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) + * [EN] + * + * [RU] + * Добавляет элемент словаря в конец словаря [dict] c ключом [key] и данными [data]. + * Если словарь не существует, создаёт его +*/ +#define yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) {if (!dict) dict=yon_dictionary_new_with_data(key,data); \ + else dict=yon_dictionary_append_with_data(dict,key,data);} + +dictionary *yon_dictionary_new(); -dictionary *yon_dictionary_create_conneced(dictionary *targetdict); +dictionary *yon_dictionary_append(dictionary *targetdict); dictionary *yon_dictionary_get_last(dictionary *dict); -dictionary *yon_dictionary_switch_places(dictionary *dict, int aim); +dictionary *yon_dictionary_swap(dictionary *dict, int aim); void yon_dictionary_make_first(dictionary *dict); void yon_dictionary_make_nth(dictionary *dict, int nth); -dictionary *yon_dictionary_create_with_data(char *key, void *data); +dictionary *yon_dictionary_new_with_data(char *key, void *data); -dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data); +dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data); dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect); -dictionary *yon_dictionary_find(dictionary **dict, char *key); +dictionary *yon_dictionary_get(dictionary **dict, char *key); dictionary *yon_dictionary_rip(dictionary *dict); @@ -111,7 +124,9 @@ void *yon_dictionary_free_all(dictionary *dictionary,void (data_manipulation)(vo // char functions -char *yon_char_get_augumented(char *source, char *append); +int yon_char_find_last(char *source, char find); + +char *yon_char_append(char *source, char *append); char *yon_char_new(char *chr); @@ -129,7 +144,7 @@ char *yon_char_replace(char *source, char *find, char*replace); char **yon_char_parse(char *parameters, int *size, char *divider); -char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete); +char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete); int yon_char_parsed_check_exist(char **parameters, int size, char *param); @@ -137,10 +152,22 @@ int yon_char_find_count(char *source, char *find); int yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size); -config_str yon_char_parsed_new (config_str old, int *old_size, ...); +config_str yon_char_parsed_new (int *size, ...); + +void yon_char_parsed_copy(config_str *source, config_str *to_copy); + +config_str yon_char_parsed_append(config_str parsed, int *size, char *string); + +int yon_ubl_check_root(); + +char *yon_ubl_root_user_get(); + +char *yon_ubl_user_get_home_directory(); // parsing functions +config_str philos_list_user(int* size); + apps *yon_apps_scan_and_parse_desktops(int *sizef); void yon_apps_sort(apps *applist, int size); @@ -149,31 +176,57 @@ apps *yon_apps_get_by_name(apps *applist, char *name, int size); config_str yon_config_load(char *command, int *str_len); -int yon_config_save(char *command); +int yon_config_save_registered(char *command); char *yon_config_get_parameter(config_str parameters, int size, char *param); -char *yon_config_make_save_parameter_with_multiple_arguments(char *parameter_string, char *config_parameter, char *divider); +int yon_config_load_register(char *command); -// terminal-using functions +int yon_config_remove_by_key(char *key); -int yon_launch_app(char *name); +int yon_config_remove_by_data(void *data); + +int yon_config_remove_element(char *key, char *deleted); + +void *yon_config_get_by_key(char *key); + +char *yon_config_get_key_by_data(char *data); + +int yon_config_set(char *key, void *data); + +int yon_config_clean(); + +void yon_config_register(char *key, void *data); + +config_str yon_config_get_all(); + +// terminal-using functions int yon_launch_app_with_arguments(char *name, char *args); -int yon_launch(thread_output *thread); +void yon_launch(char *command); // Gtk functions #ifdef __GTK_H__ #ifdef VTE_TERMINAL - -/** - * -*/ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument); + +void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument); + #endif +enum YON_TYPE{ + YON_TYPE_STRING, + YON_TYPE_STRING_LIST, + YON_TYPE_INT, + YON_TYPE_BOOLEAN, + YON_TYPE_OTHER +}; + +GtkWidget *yon_ubl_menu_item_about_new(char *buttonname); +GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname); + /**yon_gtk_builder_get_widget(builder, widget_name) * [EN] * Returns GtkWidget from GtkBuilder *[builder]. @@ -190,11 +243,19 @@ typedef struct GtkListStore *List; } expander_icon_view; -// GtkWidget *yon_gtk_app_chooser_apps_create(); +void yon_window_config_setup(GtkWindow *window); + +int yon_window_config_load(char *path); -// dictionary *yon_gtk_app_chooser_create(); +config_str yon_window_config_get_section(char *section, gsize *size); -// expander_icon_view yon_gtk_icon_view_expander_create(GtkWidget *pack, ...); +void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type); + +void yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type); + +void yon_window_config_erase_custom_parameter(char *param_name, char *section); + +int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type); int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); @@ -202,8 +263,9 @@ int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find); int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); -int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); -int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); +int yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...); + +int yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...); @@ -287,10 +349,13 @@ void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type); * [imag_path] - путь до картинки, загружаемой в [image] */ #define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) +#define yon_ubl_header_setup_resource(overlay, head, image, imag_path) _yon_ubl_header_setup_resource(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) #endif void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); +void _yon_ubl_header_setup_resource(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); + void yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id); #ifdef WEBKIT_FOUND diff --git a/ubl-settings-repomanager-sign.glade b/ubl-settings-repomanager-sign.glade new file mode 100644 index 0000000..491c267 --- /dev/null +++ b/ubl-settings-repomanager-sign.glade @@ -0,0 +1,132 @@ + + + + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + 450 + False + True + com.ublinux.ubl-settings-repomanager + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 10 + + + True + False + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + True + 0 + + + + + True + False + end + 5 + True + + + Cancel + True + True + True + image16 + + + + True + True + 0 + + + + + Save + True + True + True + image17 + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + True + False + True + + + True + False + Repository manager + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-repomanager + + + + + + diff --git a/ubl-settings-repomanager-windows.glade b/ubl-settings-repomanager-windows.glade new file mode 100644 index 0000000..98d4bbd --- /dev/null +++ b/ubl-settings-repomanager-windows.glade @@ -0,0 +1,549 @@ + + + + + + + + + + + + + + + master + True + + + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + 450 + 150 + False + True + com.ublinux.ubl-settings-repomanager + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 10 + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Name: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 4 + + + Choose repository folder + True + True + True + start + + + False + True + 0 + + + + + True + False + True + 0 + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + + + False + Branches: + 0 + + + False + True + 0 + + + + + False + True + 2 + + + + + True + False + 5 + + + True + True + never + in + + + True + False + + + True + curRepoEditList + False + True + 0 + False + + + + + + column + + + True + < Type branch name > + + + 0 + + + + + + + + + + + + + + True + True + 0 + + + + + True + True + 3 + + + + + True + True + 0 + + + + + True + False + end + 5 + True + + + Cancel + True + True + True + image14 + + + + True + True + 0 + + + + + Save + True + True + True + image15 + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + True + False + True + + + True + False + Repository manager + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-repomanager + + + + + + + True + False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + 450 + 150 + False + True + com.ublinux.ubl-settings-repomanager + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 10 + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Name: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + False + Branches: + 0 + + + False + True + 0 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + True + never + in + + + True + False + + + True + curRepoEditList + False + 0 + False + + + none + + + + + column + + + + 0 + + + + + + + + + + + + + + True + True + 0 + + + + + True + True + 3 + + + + + True + True + 0 + + + + + True + False + end + 5 + True + + + Cancel + True + True + True + image16 + + + + True + True + 0 + + + + + Save + True + True + True + image17 + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + True + False + True + + + True + False + Repository manager + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-repomanager + + + + + + diff --git a/ubl-settings-repomanager.css b/ubl-settings-repomanager.css index 8687d4a..7f91a20 100644 --- a/ubl-settings-repomanager.css +++ b/ubl-settings-repomanager.css @@ -48,17 +48,23 @@ background:transparent; } .menuitemtop *{ margin:2px 2px 0 2px; - padding: 5px 10px 3px 5px; + padding-top:2px; + padding-bottom:2px; + /* padding: 5px 0px 3px 5px; */ border:transparent; } .menuitemmiddle *{ margin:0 2px 0 2px; - padding: 3px 10px 3px 5px; + padding-top:2px; + padding-bottom:2px; + /* padding: 3px 0px 3px 5px; */ border:transparent; } .menuitembottom *{ margin:0 2px 2px 2px; - padding: 3px 10px 5px 5px; + padding-top:2px; + padding-bottom:2px; + /* padding: 3px 0px 5px 5px; */ } .menuitemtop:hover { background:@theme_bg_color; @@ -83,19 +89,25 @@ background:transparent; } .menuitemtop:hover* { margin:2px 2px 0 2px; - padding: 5px 10px 3px 5px; + padding-top:2px; + padding-bottom:2px; + /* padding: 5px 0 3px 5px; */ background:@theme_selected_bg_color; border-radius:2px; } .menuitemmiddle:hover* { - margin:0 2px 0 2px; - padding: 3px 10px 3px 5px; + margin:0 2px 0px 2px; + padding-top:2px; + padding-bottom:2px; + /* padding: 3px 0px 3px 5px; */ background:@theme_selected_bg_color; border-radius:2px; } .menuitembottom:hover* { margin:0 2px 2px 2px; - padding: 3px 10px 5px 5px; + padding-top:2px; + padding-bottom:2px; + /* padding: 3px 0px 5px 5px; */ background:@theme_selected_bg_color; border-radius:2px; } @@ -105,4 +117,21 @@ background:transparent; .boxInfoMessOK{ background-color: #f3f0ac; +} +.invisprogress { + background-color:transparent; + color:transparent; + +} +.invisprogress.osd { + background:transparent; + color:transparent; +} +.invisprogress.trough * { + background:transparent; + color:transparent; +} +.invisprogress.trough.empty { + background:transparent; + color:transparent; } \ No newline at end of file diff --git a/ubl-settings-repomanager.glade b/ubl-settings-repomanager.glade index d531ee6..97bde26 100644 --- a/ubl-settings-repomanager.glade +++ b/ubl-settings-repomanager.glade @@ -190,6 +190,40 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 65536 1 @@ -200,11 +234,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. False document-new-symbolic - - True - False - document-edit-symbolic - True False @@ -228,7 +257,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. True False - preferences-other-symbolic + system-run-symbolic True @@ -238,17 +267,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. True False - system-shutdown-symbolic - - - True - False - document-send-symbolic - - - True - False - emblem-synchronizing-symbolic + com.ublinux.ubl-settings-repomanager.document-sign-symbolic True @@ -481,28 +500,6 @@ translated and supported by community. False False False - - - True - False - Documentation - True - - - - - - True - False - About - - - True @@ -539,14 +536,6 @@ translated and supported by community. - - - - - - - - 800 600 @@ -682,9 +671,11 @@ translated and supported by community. True True + 40 edit-find-symbolic False False + name False @@ -700,20 +691,175 @@ translated and supported by community. - + True - False - 5 + True + 395 + True True False - vertical + 5 + 5 5 - + True False + vertical + 5 + + + True + False + + + False + True + 0 + + + + + True + True + True + Create repository + image1 + + + + False + True + 1 + + + + + True + True + True + Open existing repository + image2 + + + + False + True + 2 + + + + + True + True + Configure repository + image3 + + + + False + True + 3 + + + + + True + True + True + Delete repository + image4 + + + + False + True + 4 + + + + + True + False + + + False + True + 5 + + + + + True + True + True + Sign + image5 + + + + False + True + 6 + + + + + True + False + + + False + True + 7 + + + + + True + True + True + Add package + image11 + + + + False + True + 11 + + + + + True + True + True + Remove package + image12 + + + + False + True + 12 + + False @@ -722,247 +868,599 @@ translated and supported by community. - + True - True - True - image1 + False + 0 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + True + + + True + False + none + + + True + True + RepoStore + False + treeviewcolumn2 + 0 + + + + + + column + + + + + column + + + + 0 + + + + + [D] + + + 5 + + + + + + 1 + + + + + + + + + + + + + + + - False + True True 1 + + + False + True + + + + + True + True + 5 + 5 + False - + True - True - True - image2 - + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + False + 5 + + + True + False + start + Code name: + 0 + + + + + + False + True + 0 + + + + + True + False + True + 0 + + + False + True + 1 + + + + + False + True + 0 + + + + + False + 5 + + + True + False + start + Branch: + 0 + + + + + + False + True + 0 + + + + + True + False + True + 0 + + + False + True + 1 + + + + + False + True + 1 + + + + + False + 5 + + + True + False + start + Version: + 0 + + + + + + False + True + 0 + + + + + True + False + True + 0 + + + False + True + 1 + + + + + False + True + 2 + + + + + False + 5 + + + True + False + start + Architecture: + 0 + + + + + + False + True + 0 + + + + + True + False + True + 0 + + + False + True + 1 + + + + + False + True + 3 + + + + + False + 5 + + + True + False + start + Dependences: + 0 + + + + + + False + True + 0 + + + + + True + False + True + 0 + + + False + True + 1 + + + + + False + True + 4 + + + + + False + 5 + + + True + False + start + Signature: + 0 + + + + + + False + True + 0 + + + + + True + False + True + 0 + + + False + True + 1 + + + + + False + True + 5 + + - - False - True - 2 - - - + + True - True - True - image3 - + False + General - False - True - 3 + False - + True - True - True - image4 - + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + Trusted repository + True + True + False + start + True + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Server type: + 0 + + + False + True + 0 + + + + + True + False + 0 + + HTML + local + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + IP adress: + 0 + + + False + True + 0 + + + + + True + False + 0 + True + + 192.168.1.110 + + + + False + + + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + 5 + + + True + False + Port: + 0 + + + False + True + 0 + + + + + True + True + 0 + adjustment1 + + + False + True + 1 + + + + + False + True + 3 + + + + + True + False + 5 + + + True + False + True + + + True + True + 0 + + + + + True + True + True + image13 + + + + False + True + 1 + + + + + False + True + 4 + + + + + Publish + True + True + True + start + + + False + True + 5 + + - False - True - 4 + 1 - - + + True False + Publication - False - True - 5 + 1 + False - - - True - True - True - image6 - - - - False - True - 6 - - - - - True - True - True - image5 - - - - False - True - 7 - - - - - True - False - - - False - True - 8 - - - - - True - True - True - image7 - - - - False - True - 9 - - - - - True - True - True - image10 - - - - False - True - 10 - - - - - True - True - True - image11 - - - - False - True - 11 - - - - - True - True - True - image12 - - - - False - True - 12 - - - - - False - True - 0 - - - - - True - False - 0 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - True - treestore1 - False - treeviewcolumn1 - 5 - - - - - - column - - - - - column - - - - - - - - - - - - - - - - True - True - 1 + True + True @@ -979,498 +1477,6 @@ translated and supported by community. 0 - - - True - True - - - True - False - 5 - 5 - 5 - 5 - vertical - 5 - - - True - False - 20 - - - True - False - Code name: - 0 - - - - - - False - True - 0 - - - - - True - False - extend - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 20 - - - True - False - Branch: - 0 - - - - - - False - True - 0 - - - - - True - False - stable - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - 20 - - - True - False - Version: - 0 - - - - - - False - True - 0 - - - - - True - False - 2204 - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - 20 - - - True - False - Architecture: - 0 - - - - - - False - True - 0 - - - - - True - False - amd64 - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - 20 - - - True - False - Components: - 0 - - - - - - False - True - 0 - - - - - True - False - main contrib non-free - - - False - True - 1 - - - - - False - True - 4 - - - - - True - False - 20 - - - True - False - Signature: - 0 - - - - - - False - True - 0 - - - - - True - False - signed - - - False - True - 1 - - - - - False - True - 5 - - - - - - - True - False - General - - - False - - - - - True - False - 5 - 5 - 5 - 5 - vertical - 5 - - - Trusted repository - True - True - False - start - True - - - False - True - 0 - - - - - True - False - 5 - - - True - False - Server type: - 0 - - - False - True - 0 - - - - - True - False - 0 - - HTML - local - - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - 5 - - - True - False - Ip adress: - 0 - - - False - True - 0 - - - - - True - False - 0 - True - - 192.168.1.110 - - - - False - 192.168.1.110 - - - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - 5 - - - True - False - Port: - 0 - - - False - True - 0 - - - - - True - True - adjustment1 - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - 5 - - - True - True - - - True - True - 0 - - - - - True - True - True - image13 - - - - False - True - 1 - - - - - False - True - 4 - - - - - Publish - True - True - True - start - - - False - True - 5 - - - - - 1 - - - - - True - False - Publication - - - 1 - False - - - - - True - True - 1 - - True @@ -1534,7 +1540,6 @@ translated and supported by community. False - True True False True @@ -1596,9 +1601,23 @@ translated and supported by community. False True + end 1 + + + Save + True + True + True + + + False + True + 2 + + end @@ -1607,7 +1626,6 @@ translated and supported by community. - True False @@ -1664,28 +1682,14 @@ translated and supported by community. - - - - - - - - - - - - - - - + - - - - - + + + + + diff --git a/ubl-settings-repomanager.pot b/ubl-settings-repomanager.pot index 3c33c27..059b661 100644 --- a/ubl-settings-repomanager.pot +++ b/ubl-settings-repomanager.pot @@ -66,185 +66,263 @@ msgid "Lock global configration loading" msgstr "" #: source/ubl-strings.h:4 +msgid "" +"Warning! Application was launched without root - root-dependent actions are " +"locked" +msgstr "" + +#: source/ubl-strings.h:6 msgid "Repository manager" msgstr "" -#: source/ubl-strings.h:5 +#: source/ubl-strings.h:7 msgid "Repository management and configuring" msgstr "" -#: source/ubl-strings.h:7 +#: source/ubl-strings.h:8 +msgid "Operation succeeded" +msgstr "" + +#: source/ubl-strings.h:10 msgid "About" msgstr "" -#: source/ubl-strings.h:8 +#: source/ubl-strings.h:11 msgid "Documentation" msgstr "" -#: source/ubl-strings.h:9 +#: source/ubl-strings.h:13 msgid "Save to local configuration" msgstr "" -#: source/ubl-strings.h:10 +#: source/ubl-strings.h:14 msgid "Save to global configuration" msgstr "" -#: source/ubl-strings.h:11 +#: source/ubl-strings.h:15 msgid "Save configuration" msgstr "" -#: source/ubl-strings.h:12 +#: source/ubl-strings.h:16 msgid "Save" msgstr "" -#: source/ubl-strings.h:13 +#: source/ubl-strings.h:18 msgid "Load local configuration" msgstr "" -#: source/ubl-strings.h:14 +#: source/ubl-strings.h:19 msgid "Load global configuration" msgstr "" -#: source/ubl-strings.h:15 +#: source/ubl-strings.h:20 msgid "Load" msgstr "" -#: source/ubl-strings.h:17 +#: source/ubl-strings.h:22 msgid "Cancel" msgstr "" -#: source/ubl-strings.h:19 +#: source/ubl-strings.h:24 msgid "Would you like to read documentation in the Web?" msgstr "" -#: source/ubl-strings.h:20 +#: source/ubl-strings.h:25 msgid "" "You will be redirected to documentation website where documentation is\n" "translated and supported by community." msgstr "" -#: source/ubl-strings.h:21 +#: source/ubl-strings.h:26 msgid "Always redirect to online documentation" msgstr "" -#: source/ubl-strings.h:22 +#: source/ubl-strings.h:27 msgid "Open documentation" msgstr "" -#: source/ubl-strings.h:23 +#: source/ubl-strings.h:28 msgid "Project Home Page" msgstr "" -#: source/ubl-strings.h:24 +#: source/ubl-strings.h:29 msgid "Nothing were chosen" msgstr "" -#: source/ubl-strings.h:27 -msgid "Global configuration loading succseeded." -msgstr "" - -#: source/ubl-strings.h:28 -msgid "Local configuration loading succseeded." -msgstr "" - -#: source/ubl-strings.h:30 -msgid "Local and global configuration saving succseeded." -msgstr "" - #: source/ubl-strings.h:31 -msgid "Global configuration saving succseeded." +msgid "Repository data has been loaded successfully" msgstr "" -#: source/ubl-strings.h:32 -msgid "Local configuration saving succseeded." +#: source/ubl-strings.h:33 +msgid "Saving has succseeded" msgstr "" -#: source/ubl-strings.h:34 +#: source/ubl-strings.h:35 msgid "General" msgstr "" -#: source/ubl-strings.h:35 +#: source/ubl-strings.h:36 msgid "Publication" msgstr "" -#: source/ubl-strings.h:36 +#: source/ubl-strings.h:37 msgid "Trusted repository" msgstr "" -#: source/ubl-strings.h:37 +#: source/ubl-strings.h:38 msgid "Server type:" msgstr "" -#: source/ubl-strings.h:38 +#: source/ubl-strings.h:39 msgid "IP adress:" msgstr "" -#: source/ubl-strings.h:39 +#: source/ubl-strings.h:40 msgid "Port:" msgstr "" -#: source/ubl-strings.h:40 +#: source/ubl-strings.h:41 msgid "Publish" msgstr "" -#: source/ubl-strings.h:41 +#: source/ubl-strings.h:42 msgid "Code name:" msgstr "" -#: source/ubl-strings.h:42 +#: source/ubl-strings.h:43 msgid "Branch:" msgstr "" -#: source/ubl-strings.h:43 +#: source/ubl-strings.h:44 msgid "Architecture:" msgstr "" -#: source/ubl-strings.h:44 +#: source/ubl-strings.h:45 msgid "Components:" msgstr "" -#: source/ubl-strings.h:45 +#: source/ubl-strings.h:46 msgid "Signature:" msgstr "" #: source/ubl-strings.h:47 +msgid "Sign" +msgstr "" + +#: source/ubl-strings.h:49 msgid "Create repository" msgstr "" -#: source/ubl-strings.h:48 +#: source/ubl-strings.h:50 msgid "Open existing repository" msgstr "" -#: source/ubl-strings.h:49 +#: source/ubl-strings.h:51 msgid "Configure repository" msgstr "" -#: source/ubl-strings.h:50 +#: source/ubl-strings.h:52 msgid "Delete repository" msgstr "" -#: source/ubl-strings.h:51 +#: source/ubl-strings.h:53 msgid "" "Add/Remove repository from\n" "local package sources" msgstr "" -#: source/ubl-strings.h:52 +#: source/ubl-strings.h:54 msgid "Enable/disable repository publish" msgstr "" -#: source/ubl-strings.h:53 +#: source/ubl-strings.h:55 msgid "Check dependences" msgstr "" -#: source/ubl-strings.h:54 +#: source/ubl-strings.h:56 msgid "Sign ripository" msgstr "" -#: source/ubl-strings.h:55 +#: source/ubl-strings.h:57 msgid "Add package" msgstr "" -#: source/ubl-strings.h:56 +#: source/ubl-strings.h:58 msgid "Remove package" msgstr "" + +#: source/ubl-strings.h:59 +msgid "Open" +msgstr "" + +#: source/ubl-strings.h:61 +msgid "Operation done" +msgstr "" + +#: source/ubl-strings.h:63 +msgid "Choose branch or pack in branch to add file!" +msgstr "" + +#: source/ubl-strings.h:64 +msgid "Choose repository or branch!" +msgstr "" + +#: source/ubl-strings.h:65 +msgid "Choose pack to delete!" +msgstr "" + +#: source/ubl-strings.h:66 +msgid "Choose repository to delete!" +msgstr "" + +#: source/ubl-strings.h:67 +msgid "Choose repository or package to sign" +msgstr "" + +#: source/ubl-strings.h:69 +msgid "Name:" +msgstr "" + +#: source/ubl-strings.h:70 +msgid "Branches:" +msgstr "" + +#: source/ubl-strings.h:71 +msgid "< Type branch name >" +msgstr "" + +#: source/ubl-strings.h:72 +msgid "Name must be filled!" +msgstr "" + +#: source/ubl-strings.h:73 +msgid "Choose path for new repository" +msgstr "" + +#: source/ubl-strings.h:75 +msgid "Choose repository folder" +msgstr "" + +#: source/ubl-strings.h:76 +msgid "Choose repository" +msgstr "" + +#: source/ubl-strings.h:78 +msgid "Absent" +msgstr "" + +#: source/ubl-strings.h:79 +msgid "Dependences:" +msgstr "" + +#: source/ubl-strings.h:80 +msgid "Digital signature" +msgstr "" + +#: source/ubl-strings.h:82 +msgid "package" +msgstr "" + +#: source/ubl-strings.h:83 +msgid "repository" +msgstr "" diff --git a/ubl-settings-repomanager_ru.po b/ubl-settings-repomanager_ru.po index d032859..3ef037e 100644 --- a/ubl-settings-repomanager_ru.po +++ b/ubl-settings-repomanager_ru.po @@ -50,7 +50,6 @@ msgid "Lock this help menu" msgstr "Блокировка вызова справки" #: source/ubl-strings.h:2 -#, fuzzy msgid "Lock configuration saving" msgstr "Блокировка сохранения локальной и глобальной конфигурации" @@ -67,58 +66,70 @@ msgid "Lock global configration loading" msgstr "Блокировка загрузки глобальной конфигурации" #: source/ubl-strings.h:4 +msgid "" +"Warning! Application was launched without root - root-dependent actions are " +"locked" +msgstr "" +"Внимание! Приложение было запущено без прав суперпользователя - действия, " +"требующие их наличия заблокированы" + +#: source/ubl-strings.h:6 msgid "Repository manager" msgstr "Менеджер репозиториев" -#: source/ubl-strings.h:5 +#: source/ubl-strings.h:7 msgid "Repository management and configuring" msgstr "Настройка параметров и управление репозиториями системы" -#: source/ubl-strings.h:7 +#: source/ubl-strings.h:8 +msgid "Operation succeeded" +msgstr "Операция завершена" + +#: source/ubl-strings.h:10 msgid "About" msgstr "О программе" -#: source/ubl-strings.h:8 +#: source/ubl-strings.h:11 msgid "Documentation" msgstr "Справка" -#: source/ubl-strings.h:9 +#: source/ubl-strings.h:13 msgid "Save to local configuration" msgstr "Сохранить в локальную конфигурацию" -#: source/ubl-strings.h:10 +#: source/ubl-strings.h:14 msgid "Save to global configuration" msgstr "Сохранить в глобальную конфигурацию" -#: source/ubl-strings.h:11 +#: source/ubl-strings.h:15 msgid "Save configuration" msgstr "Сохранить конфигурацию" -#: source/ubl-strings.h:12 +#: source/ubl-strings.h:16 msgid "Save" msgstr "Сохранить" -#: source/ubl-strings.h:13 +#: source/ubl-strings.h:18 msgid "Load local configuration" msgstr "Загрузить локальную конфигуруцию" -#: source/ubl-strings.h:14 +#: source/ubl-strings.h:19 msgid "Load global configuration" msgstr "Загрузить глобальную конфигурацию" -#: source/ubl-strings.h:15 +#: source/ubl-strings.h:20 msgid "Load" msgstr "Загрузить" -#: source/ubl-strings.h:17 +#: source/ubl-strings.h:22 msgid "Cancel" msgstr "Отмена" -#: source/ubl-strings.h:19 +#: source/ubl-strings.h:24 msgid "Would you like to read documentation in the Web?" msgstr "Вы хотите прочитать справку в Сети?" -#: source/ubl-strings.h:20 +#: source/ubl-strings.h:25 msgid "" "You will be redirected to documentation website where documentation is\n" "translated and supported by community." @@ -126,129 +137,199 @@ msgstr "" "Вы будете перенаправлены на сайт с документацией где страницы помощи\n" "переводятся и поддерживаются сообществом." -#: source/ubl-strings.h:21 +#: source/ubl-strings.h:26 msgid "Always redirect to online documentation" msgstr "Всегда перенаправлять" -#: source/ubl-strings.h:22 +#: source/ubl-strings.h:27 msgid "Open documentation" msgstr "Прочитать справку" -#: source/ubl-strings.h:23 +#: source/ubl-strings.h:28 msgid "Project Home Page" msgstr "Домашняя страница проекта" -#: source/ubl-strings.h:24 +#: source/ubl-strings.h:29 msgid "Nothing were chosen" msgstr "Ничего не было выбрано" -#: source/ubl-strings.h:27 -msgid "Global configuration loading succseeded." -msgstr "Успешно загружена глобальная конфигурация" - -#: source/ubl-strings.h:28 -msgid "Local configuration loading succseeded." -msgstr "Успешно загружена локальная конфигурация" - -#: source/ubl-strings.h:30 -msgid "Local and global configuration saving succseeded." -msgstr "Успешно записаны локальная и глобальная конфигурация" - #: source/ubl-strings.h:31 -msgid "Global configuration saving succseeded." -msgstr "Успешно записана глобальная конфигурация" +msgid "Repository data has been loaded successfully" +msgstr "Информация о пакетах успешно загружена" -#: source/ubl-strings.h:32 -msgid "Local configuration saving succseeded." -msgstr "Успешно записана локальная конфигурация" +#: source/ubl-strings.h:33 +#, fuzzy +msgid "Saving has succseeded" +msgstr "Успешно сохранено" -#: source/ubl-strings.h:34 +#: source/ubl-strings.h:35 msgid "General" msgstr "Общие" -#: source/ubl-strings.h:35 +#: source/ubl-strings.h:36 msgid "Publication" msgstr "Публикация" -#: source/ubl-strings.h:36 +#: source/ubl-strings.h:37 msgid "Trusted repository" msgstr "Доверенный репозиторий" -#: source/ubl-strings.h:37 +#: source/ubl-strings.h:38 msgid "Server type:" msgstr "Тип сервера:" -#: source/ubl-strings.h:38 +#: source/ubl-strings.h:39 msgid "IP adress:" msgstr "IP-адрес:" -#: source/ubl-strings.h:39 +#: source/ubl-strings.h:40 msgid "Port:" msgstr "Порт:" -#: source/ubl-strings.h:40 +#: source/ubl-strings.h:41 msgid "Publish" msgstr "Опубликовать" -#: source/ubl-strings.h:41 +#: source/ubl-strings.h:42 msgid "Code name:" msgstr "Кодовое имя:" -#: source/ubl-strings.h:42 +#: source/ubl-strings.h:43 msgid "Branch:" msgstr "Ветка:" -#: source/ubl-strings.h:43 +#: source/ubl-strings.h:44 msgid "Architecture:" msgstr "Архитектура:" -#: source/ubl-strings.h:44 +#: source/ubl-strings.h:45 msgid "Components:" msgstr "Компоненты" -#: source/ubl-strings.h:45 +#: source/ubl-strings.h:46 msgid "Signature:" -msgstr "Подпись" +msgstr "Подпись:" #: source/ubl-strings.h:47 +msgid "Sign" +msgstr "Подписать" + +#: source/ubl-strings.h:49 msgid "Create repository" msgstr "Создать репозиторий" -#: source/ubl-strings.h:48 +#: source/ubl-strings.h:50 msgid "Open existing repository" msgstr "Открыть и добавить репозиторий" -#: source/ubl-strings.h:49 +#: source/ubl-strings.h:51 msgid "Configure repository" msgstr "Редактировать репозиторий" -#: source/ubl-strings.h:50 +#: source/ubl-strings.h:52 msgid "Delete repository" msgstr "Удалить репозиторий" -#: source/ubl-strings.h:51 +#: source/ubl-strings.h:53 msgid "" "Add/Remove repository from\n" "local package sources" -msgstr "Добавить/удалить репу из\n" +msgstr "" +"Добавить/удалить репу из\n" " локальных источников пакетов" -#: source/ubl-strings.h:52 +#: source/ubl-strings.h:54 msgid "Enable/disable repository publish" msgstr "Включить/отключить публикацию" -#: source/ubl-strings.h:53 +#: source/ubl-strings.h:55 msgid "Check dependences" msgstr "Проверить на битые зависимости" -#: source/ubl-strings.h:54 +#: source/ubl-strings.h:56 msgid "Sign ripository" msgstr "Подпись пакетов" -#: source/ubl-strings.h:55 +#: source/ubl-strings.h:57 msgid "Add package" msgstr "Добавить пакет" -#: source/ubl-strings.h:56 +#: source/ubl-strings.h:58 msgid "Remove package" msgstr "Удалить пакет" + +#: source/ubl-strings.h:59 +msgid "Open" +msgstr "Открыть" + +#: source/ubl-strings.h:61 +msgid "Operation done" +msgstr "Операция завершена" + +#: source/ubl-strings.h:63 +msgid "Choose branch or pack in branch to add file!" +msgstr "Выберите ветку чтобы добавить пакет!" + +#: source/ubl-strings.h:64 +msgid "Choose repository or branch!" +msgstr "Выберите репозиторий!" + +#: source/ubl-strings.h:65 +msgid "Choose pack to delete!" +msgstr "Выберите пакет для удаления!" + +#: source/ubl-strings.h:66 +msgid "Choose repository to delete!" +msgstr "Выберите репозиторий для удаления!" + +#: source/ubl-strings.h:67 +msgid "Choose repository or package to sign" +msgstr "Выберите репозиторий или пакет для подписи" + +#: source/ubl-strings.h:69 +msgid "Name:" +msgstr "Название:" + +#: source/ubl-strings.h:70 +msgid "Branches:" +msgstr "Ветки:" + +#: source/ubl-strings.h:71 +msgid "< Type branch name >" +msgstr "< Введите название ветки >" + +#: source/ubl-strings.h:72 +msgid "Name must be filled!" +msgstr "Введите название!" + +#: source/ubl-strings.h:73 +msgid "Choose path for new repository" +msgstr "Выбрать расположение нового репозитория" + +#: source/ubl-strings.h:75 +msgid "Choose repository folder" +msgstr "Выбрать директорию для репозитория" + +#: source/ubl-strings.h:76 +msgid "Choose repository" +msgstr "Выбрать репозиторий" + +#: source/ubl-strings.h:78 +msgid "Absent" +msgstr "Отсутствует" + +#: source/ubl-strings.h:79 +msgid "Dependences:" +msgstr "Зависит от:" + +#: source/ubl-strings.h:80 +msgid "Digital signature" +msgstr "Цифровая подпись" + +#: source/ubl-strings.h:82 +msgid "package" +msgstr "пакет" + +#: source/ubl-strings.h:83 +msgid "repository" +msgstr "репозиторий" \ No newline at end of file