diff --git a/.gitignore b/.gitignore index 57ab3b7..f3b220d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ ubl-settings-update.glade~ ubl-settings-update ubl-settings-update_ru.po~ build/ +compile/ diff --git a/Makefile b/Makefile index aef26b5..0a510ff 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,7 @@ uninstall: @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg" @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/${PKGNAME}-banner.png" @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}" + @$(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}.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; \ @@ -111,6 +112,8 @@ install: check uninstall done @install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" + @install -dm755 "${DESTDIR}${PREFIX}/share/polkit-1/actions" + @install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "com.ublinux.${PKGNAME}.policy" @install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" @install -dm755 "${DESTDIR}/etc/xdg" @install -dm755 "${DESTDIR}${PREFIX}/share/applications" diff --git a/com.ublinux.ubl-settings-update.policy b/com.ublinux.ubl-settings-update.policy new file mode 100644 index 0000000..4eaf3e9 --- /dev/null +++ b/com.ublinux.ubl-settings-update.policy @@ -0,0 +1,24 @@ + + + + + UBLinux + https://ublinux.ru + + + Run ubl-settings-update as root + Запуск утилиты ubl-settings-update с правами root + Authentication is required to run ubl-settings-update + Требуется авторизация для запуска утилиты ubl-settings-update с правами root + + auth_admin + auth_admin + auth_admin + + /usr/bin/ubl-settings-update + true + + + diff --git a/com.ublinux.ubl-settings-update.svg b/com.ublinux.ubl-settings-update.svg index f636c26..bc1245d 100644 --- a/com.ublinux.ubl-settings-update.svg +++ b/com.ublinux.ubl-settings-update.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-update.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="filter55276" + x="-0.14871371" + y="-0.14870605" + width="1.2362248" + height="1.2362127"> + id="feFlood55266" /> + id="feComposite55268" /> + + + + + + + + + + + + + + + + id="feGaussianBlur104562" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="feOffset32783" /> + id="feComposite32785" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/screenshot/screenshot.png b/screenshot/screenshot.png new file mode 100644 index 0000000..485ce22 Binary files /dev/null and b/screenshot/screenshot.png differ diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b961ad3..ba44ab8 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -8,23 +8,41 @@ include_directories(${GTK_INCLUDE_DIRS}) link_directories(${GTK_LIBRARY_DIRS}) add_definitions(${GTK_CFLAGS_OTHER}) +find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) + +option(WEBKIT_FOUND "No" OFF) +if(WEBKIT_LIBRARIES_FOUND) + option(WEBKIT_FOUND "Yes" ON) + PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0 webkit2gtk-web-extension-4.0) + include_directories(${WEBKIT_INCLUDE_DIRS}) + link_directories(${WEBKIT_LIBRARY_DIRS}) + add_definitions(${WEBKIT_CFLAGS_OTHER}) +endif() + +configure_file(ubl-settings-update.h.in ubl-settings-cmake.h) + + #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") + -fstack-clash-protection -fcf-protection -g") set(SOURCE_FILES ubl-settings-update.c ubl-settings-update.h - ubl-utils.c) + ubl-utils.h + ubl-utils.c + ubl-settings-cmake.h) set(LIBRARIES ${GTK_LIBRARIES} + ${WEBKIT_LIBRARIES} pthread) -add_executable(ubl-settings-update ${SOURCE_FILES}) -target_link_libraries(ubl-settings-update ${LIBRARIES}) +add_executable(${PROJECT_NAME} ${SOURCE_FILES}) +target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES}) +target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR}) install(TARGETS ubl-settings-update DESTINATION bin) \ No newline at end of file diff --git a/source/ubl-settings-update-strings.h b/source/ubl-settings-update-strings.h new file mode 100644 index 0000000..eebe1a6 --- /dev/null +++ b/source/ubl-settings-update-strings.h @@ -0,0 +1,49 @@ +#define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL) +#define HELP_LABEL yon_char_unite(_("ubl-settings-update version:")," ", version_application,"\n",_("update settings"),"\n",_("Usage:"), " ubl-settings-update ",_("[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 TITLE_LABEL _("System update") +#define TITLE_INFO_LABEL _("System update settings management") +#define CHECK_FOR_UPDATES_LABEL _("Check for updates") +#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") +#define LAUNCH_PACKAGE_MANAGER_LABEL _("Launch package manager") +#define CACHE_CLEAN_LABEL _("Cache clean command: ") +#define UPDATE_COMMAND_LABEL _("Update command: ") +#define PACKAGE_MANAGER_LABEL _("Package manager: ") +#define URI_LABEL _("URI") +#define ENABLED_LABEL _("Enabled") +#define DISTIBUTION_LABEL _("Distribution") +#define UBUR_LABEL _("Activate UBUR") +#define AUR_LABEL _("Activate AUR") +#define EVERY_3_HOURS_LABEL _("Every 3 hours") +#define EVERY_2_HOURS_LABEL _("Every 2 hours") +#define EVERY_1_HOUR_LABEL _("Every 1 hour") +#define AUTO_UPDATE_LABEL _("Download updates automatically") +#define HIDE_NO_UPDATES_LABEL _("Hide icon of no updates found") +#define CHECK_FREQUENCY_LABEL _("Update checking frequency") +#define EXTRA_LABEL _("Extra") +#define REPOSITORIES_LABEL _("Repositories") +#define GENERAL_LABEL _("General") +#define ADRESS_LABEL _("Adress: ") +#define DISTRIBUTION_LABEL _("Distribution: ") +#define CANCEL_LABEL _("Cancel") +#define SAVE_LABEL _("Save") +#define HELP_TITLE_LABEL _("Would you like to read documentation in the Web?") +#define HELP_INFO_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.") +#define HELP_ALWAYS_OPEN_LABEL _("Always redirect to online documentation") +#define OPEN_HELP_LABEL _("Open documentation") +#define PROJECT_HOME_LABEL _("Project Home Page") +#define NOTHING_CHOSEN_LABEL _("Nothing were chosen") + +#define 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.") \ No newline at end of file diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c index 0ee60fc..21fbd5d 100644 --- a/source/ubl-settings-update.c +++ b/source/ubl-settings-update.c @@ -1,63 +1,183 @@ -#include #include "ubl-settings-update.h" -void on_repo_window_open(GtkWidget *self){ - repo_window *widgets=setup_repo_window(); -} +config main_config; +render_data render; void on_close_subwindow(GtkWidget *self){ gtk_widget_destroy(gtk_widget_get_toplevel(self)); } +void yon_open_browser(GtkWidget *self, char *link){ + yon_ubl_browser_window_open(link,TITLE_LABEL); +} + +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); + 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"); + widgets->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton"); + widgets->HatText = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel"); + widgets->HeaderText = yon_gtk_builder_get_widget(builder,"helpHeader"); + widgets->InfoText = yon_gtk_builder_get_widget(builder,"helpText"); + widgets->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox"); + gtk_label_set_text(GTK_LABEL(widgets->HatText),TITLE_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->HeaderText),HELP_TITLE_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->InfoText),HELP_INFO_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->AcceptButton),OPEN_HELP_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->AlwaysOpenCheck),HELP_ALWAYS_OPEN_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->CloseButton),CANCEL_LABEL); + gtk_widget_show_all(widgets->Window); + g_signal_connect(G_OBJECT(widgets->CloseButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + g_signal_connect(G_OBJECT(widgets->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link)); + g_signal_connect(G_OBJECT(widgets->AcceptButton),"clicked",G_CALLBACK(on_close_subwindow),NULL); + + + } else { + yon_open_browser(self,link); + } +} + +void on_link(GtkWidget *self, char* uri, gpointer user_data){ + gtk_widget_destroy(self); + on_open_documentation_confirmation(self,uri); +} + void on_about(){ GtkBuilder *builder=gtk_builder_new_from_file(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"); - gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),_("UBlinux System update")); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); - gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window),_("Project Home Page")); - gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),_("Update configurator")); + gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window),PROJECT_HOME_LABEL); + gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); + gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL); + g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),NULL); gtk_widget_set_visible(hideButtonBox,0); + gtk_widget_destroy(hideButtonBox); gtk_widget_show(window); } -repo_window *setup_repo_window(){ +void on_repos_add(GtkWidget *self, repo_window *repo){ + char *distr = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(repo->repoDistributionEntry))); + char *address = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(repo->repoTypeEntry))); + if ((distr&&address)||(strcmp(distr,"")!=0&&strcmp(address,"")!=0)){ + GtkTreeIter iter; + gtk_list_store_append(main_config.list,&iter); + gtk_list_store_set(main_config.list,&iter,1,address,2,distr,-1); + } +} + +void on_repos_delete(GtkWidget *self, GtkWidget *tree){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(main_config.list); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)),&model,&iter)){ + gtk_list_store_remove(main_config.list,&iter); + } else { + yon_ubl_status_box_render(render,NOTHING_CHOSEN_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + } +} + +void on_repos_edit(GtkWidget *self, repo_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model=GTK_TREE_MODEL(main_config.list); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->tree)),&model,&iter)){ + char *adress=yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(widgets->repoTypeEntry))); + char *distro=yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(widgets->repoDistributionEntry))); + if ((distro&&adress)||(strcmp(distro,"")!=0&&strcmp(adress,"")!=0)) + gtk_list_store_set(main_config.list,&iter,1,adress,2,distro,-1); + } +} + +void on_repo_window_open_edit(GtkWidget *self, GtkWidget *tree){ + GtkTreeIter iter; + GtkTreeModel *model=GTK_TREE_MODEL(main_config.list); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)),&model,&iter)){ + repo_window *widgets=NULL; + widgets=malloc(sizeof(repo_window)); + widgets->builder= gtk_builder_new_from_file(glade_path); + widgets->window=yon_gtk_builder_get_widget(widgets->builder, "RepoWindow"); + + widgets->repoTypeLabel=yon_gtk_builder_get_widget(widgets->builder, "repoAdressLabel"); + widgets->repoTypeEntry=yon_gtk_builder_get_widget(widgets->builder, "repoAdressEntry"); + widgets->repoDistributionLabel=yon_gtk_builder_get_widget(widgets->builder, "repoDistributionLabel"); + widgets->repoDistributionEntry=yon_gtk_builder_get_widget(widgets->builder, "repoDistributionEntry"); + + widgets->repoCancelButton=yon_gtk_builder_get_widget(widgets->builder, "repoCancelButton"); + widgets->repoAcceptButton=yon_gtk_builder_get_widget(widgets->builder, "repoAcceptButton"); + widgets->tree=tree; + + g_signal_connect(G_OBJECT(widgets->repoCancelButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); + g_signal_connect(G_OBJECT(widgets->repoAcceptButton), "clicked", G_CALLBACK(on_repos_edit), widgets); + g_signal_connect(G_OBJECT(widgets->repoAcceptButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); + char *adress = NULL; + char *distro = NULL; + gtk_tree_model_get(GTK_TREE_MODEL(main_config.list),&iter,1,&adress,2,&distro,-1); + gtk_entry_set_text(GTK_ENTRY(widgets->repoTypeEntry),adress); + gtk_entry_set_text(GTK_ENTRY(widgets->repoDistributionEntry),distro); + + gtk_window_set_title(GTK_WINDOW(widgets->window),TITLE_LABEL); + + gtk_label_set_text(GTK_LABEL(widgets->repoTypeLabel),ADRESS_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->repoDistributionLabel),DISTRIBUTION_LABEL); + + gtk_button_set_label(GTK_BUTTON(widgets->repoCancelButton),CANCEL_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->repoAcceptButton),SAVE_LABEL); + gtk_widget_show_all(widgets->window); + } else { + yon_ubl_status_box_render(render,NOTHING_CHOSEN_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + } + + +} + +repo_window *on_repo_window_open_create(GtkWidget *self){ repo_window *widgets=NULL; widgets=malloc(sizeof(repo_window)); widgets->builder= gtk_builder_new_from_file(glade_path); widgets->window=yon_gtk_builder_get_widget(widgets->builder, "RepoWindow"); - widgets->repoTypeLabel=yon_gtk_builder_get_widget(widgets->builder, "repoTypeLabel"); - widgets->repoTypeEntry=yon_gtk_builder_get_widget(widgets->builder, "repoTypeEntry"); - widgets->repoURILabel=yon_gtk_builder_get_widget(widgets->builder, "repoURILabel"); - widgets->repoURIMeanLabel=yon_gtk_builder_get_widget(widgets->builder, "repoURIMeanLabel"); + widgets->repoTypeLabel=yon_gtk_builder_get_widget(widgets->builder, "repoAdressLabel"); + widgets->repoTypeEntry=yon_gtk_builder_get_widget(widgets->builder, "repoAdressEntry"); widgets->repoDistributionLabel=yon_gtk_builder_get_widget(widgets->builder, "repoDistributionLabel"); - widgets->repoDistributionMeanLabel=yon_gtk_builder_get_widget(widgets->builder, "repoDistributionMeanLabel"); - widgets->repoSectionsLabel=yon_gtk_builder_get_widget(widgets->builder, "repoSectionsLabel"); - widgets->repoSectionsMeanlabel=yon_gtk_builder_get_widget(widgets->builder, "repoSectionsMeanlabel"); + widgets->repoDistributionEntry=yon_gtk_builder_get_widget(widgets->builder, "repoDistributionEntry"); widgets->repoCancelButton=yon_gtk_builder_get_widget(widgets->builder, "repoCancelButton"); widgets->repoAcceptButton=yon_gtk_builder_get_widget(widgets->builder, "repoAcceptButton"); g_signal_connect(G_OBJECT(widgets->repoCancelButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); + g_signal_connect(G_OBJECT(widgets->repoAcceptButton), "clicked", G_CALLBACK(on_repos_add), widgets); g_signal_connect(G_OBJECT(widgets->repoAcceptButton), "clicked", G_CALLBACK(on_close_subwindow), NULL); - gtk_window_set_title(GTK_WINDOW(widgets->window),_("System update")); + gtk_window_set_title(GTK_WINDOW(widgets->window),TITLE_LABEL); - gtk_label_set_text(GTK_LABEL(widgets->repoTypeLabel),_("Type: ")); - gtk_label_set_text(GTK_LABEL(widgets->repoURILabel),_("URI: ")); - gtk_label_set_text(GTK_LABEL(widgets->repoURIMeanLabel),_(" ")); - gtk_label_set_text(GTK_LABEL(widgets->repoDistributionLabel),_("Distribution: ")); - gtk_label_set_text(GTK_LABEL(widgets->repoDistributionMeanLabel),_(" ")); - gtk_label_set_text(GTK_LABEL(widgets->repoSectionsLabel),_("Sections: ")); - gtk_label_set_text(GTK_LABEL(widgets->repoSectionsMeanlabel),_(" ")); + gtk_label_set_text(GTK_LABEL(widgets->repoTypeLabel),ADRESS_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->repoDistributionLabel),DISTRIBUTION_LABEL); - gtk_button_set_label(GTK_BUTTON(widgets->repoCancelButton),_("Cancel")); - gtk_button_set_label(GTK_BUTTON(widgets->repoAcceptButton),_("Save")); + gtk_button_set_label(GTK_BUTTON(widgets->repoCancelButton),CANCEL_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->repoAcceptButton),SAVE_LABEL); gtk_widget_show_all(widgets->window); } +void init(GtkListStore *list){ + main_config.always_open_documentation=0; + main_config.win_height=600; + main_config.win_width=800; + main_config.win_pos_x=0; + main_config.win_pos_y=0; + main_config.socket_id=-1; + main_config.save_socket_id=-1; + main_config.load_socket_id=-1; + main_config.lock_help=0; + main_config.lock_help=0; + main_config.lock_load_global=0; + main_config.lock_save_global=0; + main_config.lock_save_local=0; + main_config.list=list; +} + main_window *setup_window(){ main_window *widgets=NULL; widgets=malloc(sizeof(main_window)); @@ -66,6 +186,10 @@ main_window *setup_window(){ widgets->HeaderTopic=yon_gtk_builder_get_widget(widgets->builder,"headerTopic"); + widgets->PlugBox=yon_gtk_builder_get_widget(widgets->builder,"plugBox"); + widgets->RightBox=yon_gtk_builder_get_widget(widgets->builder,"LeftBox"); + widgets->LeftBox=yon_gtk_builder_get_widget(widgets->builder,"RightBox"); + widgets->generalSettingsTabLabel=yon_gtk_builder_get_widget(widgets->builder,"generalTabLabel"); widgets->repositoriesSettingsTabLabel=yon_gtk_builder_get_widget(widgets->builder,"repositoriesTabLabel"); widgets->extraSettingsTabLabel=yon_gtk_builder_get_widget(widgets->builder,"extraTabLabel"); @@ -85,6 +209,7 @@ main_window *setup_window(){ widgets->repositoriesSettingsRepositoriesTreeView=yon_gtk_builder_get_widget(widgets->builder,"RepositoriesTreeView"); widgets->repositoriesSettingsEnabledColumn=GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(widgets->builder,"EnabledColumn")); widgets->repositoriesSettingsURIColumn=GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(widgets->builder,"URIColumn")); + widgets->repositoriesSettingsDistributionColumn=GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(widgets->builder,"DistributionColumn")); widgets->extraSettingsPackageManagerLabel=yon_gtk_builder_get_widget(widgets->builder,"PackageManagerLabel"); widgets->extraSettingsPackageManagerEntry=yon_gtk_builder_get_widget(widgets->builder,"PackageManagerEntry"); @@ -108,47 +233,67 @@ main_window *setup_window(){ widgets->mainCheckForUpdatesButton=yon_gtk_builder_get_widget(widgets->builder,"checkForUpdatesButton"); - gtk_window_set_title(GTK_WINDOW(widgets->window),_("System update")); - - gtk_label_set_text(GTK_LABEL(widgets->HeaderTopic),_("System update")); - - gtk_label_set_text(GTK_LABEL(widgets->generalSettingsTabLabel),_("General")); - gtk_label_set_text(GTK_LABEL(widgets->repositoriesSettingsTabLabel),_("Repositories")); - gtk_label_set_text(GTK_LABEL(widgets->extraSettingsTabLabel),_("Extra")); - - gtk_label_set_text(GTK_LABEL(widgets->generalSettingsUpdatesCheckFreqLabel),_("Update checking frequency")); - gtk_button_set_label(GTK_BUTTON(widgets->generalSettingsHideNoUpdatesCheck),_("Hide icon of no updates found")); - gtk_button_set_label(GTK_BUTTON(widgets->generalSettingsDownloadAutoCheck),_("Download updates automatically")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->generalSettingsUpdatesCheckFreqCombo),_("Every 1 hour")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->generalSettingsUpdatesCheckFreqCombo),_("Every 2 hours")); - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->generalSettingsUpdatesCheckFreqCombo),_("Every 3 hours")); - - gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsActivateAURCheck),_("Activate AUR")); - gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsActivateUBURCheck),_("Activate UBUR")); - gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsCreateButton),_("Create")); - gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsEditButton),_("Edit")); - gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsDeleteButton),_("Delete")); - gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->repositoriesSettingsEnabledColumn),_("Enabled")); - gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->repositoriesSettingsURIColumn),_("URI")); - - gtk_label_set_text(GTK_LABEL(widgets->extraSettingsPackageManagerLabel),_("Package manager: ")); - gtk_label_set_text(GTK_LABEL(widgets->extraSettingsUpdateCommandLabel),_("Update command: ")); - gtk_label_set_text(GTK_LABEL(widgets->extraSettingsCacheCleanlabel),_("Cache clean command: ")); - gtk_button_set_label(GTK_BUTTON(widgets->extraSettingsLaunchPackageManagerButton),_("Launch package manager")); - - gtk_label_set_text(GTK_LABEL(widgets->headerLoadConfigLabel),_("load")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerLoadGlobalConfigButton),_("Load global configuration")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerLoadLocalConfigButton),_("Load local configuration")); - - gtk_label_set_text(GTK_LABEL(widgets->headerSaveConfigLabel),_("Save")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerSaveGlobalLocalConfigButton),_("Save to global and local configuration")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerSaveGlobalConfigButton),_("Save to global configuration")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerSaveLocalConfigButton),_("Save to local configuration")); - - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerDocumentationButton),_("Documentation")); - gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerAboutButton),_("About")); - - gtk_button_set_label(GTK_BUTTON(widgets->mainCheckForUpdatesButton),_("Check for updates")); + widgets->mainCheckForUpdatesButton = yon_gtk_builder_get_widget(widgets->builder,"checkForUpdatesButton"); + widgets->statusBox = yon_gtk_builder_get_widget(widgets->builder,"mainStatusBox"); + widgets->statusIcon = yon_gtk_builder_get_widget(widgets->builder,"mainStatusIcon"); + widgets->statusLabel = yon_gtk_builder_get_widget(widgets->builder,"mainStatusLabel"); + + main_config.list=GTK_LIST_STORE(gtk_builder_get_object(widgets->builder,"liststore1")); + + if (main_config.lock_load_global == 1){ + gtk_widget_set_sensitive(widgets->headerLoadGlobalConfigButton,0); + } + if (main_config.lock_save_global == 1){ + gtk_widget_set_sensitive(widgets->headerSaveGlobalConfigButton,0); + gtk_widget_set_sensitive(widgets->headerSaveGlobalLocalConfigButton,0); + } + if (main_config.lock_save_local == 1){ + gtk_widget_set_sensitive(widgets->headerSaveLocalConfigButton,0); + gtk_widget_set_sensitive(widgets->headerSaveGlobalLocalConfigButton,0); + } + + gtk_window_set_title(GTK_WINDOW(widgets->window),TITLE_LABEL); + + gtk_label_set_text(GTK_LABEL(widgets->HeaderTopic),TITLE_LABEL); + + gtk_label_set_text(GTK_LABEL(widgets->generalSettingsTabLabel),GENERAL_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->repositoriesSettingsTabLabel),REPOSITORIES_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->extraSettingsTabLabel),EXTRA_LABEL); + + gtk_label_set_text(GTK_LABEL(widgets->generalSettingsUpdatesCheckFreqLabel),CHECK_FREQUENCY_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->generalSettingsHideNoUpdatesCheck),HIDE_NO_UPDATES_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->generalSettingsDownloadAutoCheck),AUTO_UPDATE_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->generalSettingsUpdatesCheckFreqCombo),EVERY_1_HOUR_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->generalSettingsUpdatesCheckFreqCombo),EVERY_2_HOURS_LABEL); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->generalSettingsUpdatesCheckFreqCombo),EVERY_3_HOURS_LABEL); + + gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsActivateAURCheck),AUR_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsActivateUBURCheck),UBUR_LABEL); + // gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsCreateButton),_("Create")); + // gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsEditButton),_("Edit")); + // gtk_button_set_label(GTK_BUTTON(widgets->repositoriesSettingsDeleteButton),_("Delete")); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->repositoriesSettingsEnabledColumn),ENABLED_LABEL); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->repositoriesSettingsURIColumn),URI_LABEL); + gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(widgets->repositoriesSettingsDistributionColumn),DISTIBUTION_LABEL); + + gtk_label_set_text(GTK_LABEL(widgets->extraSettingsPackageManagerLabel),PACKAGE_MANAGER_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->extraSettingsUpdateCommandLabel),UPDATE_COMMAND_LABEL); + gtk_label_set_text(GTK_LABEL(widgets->extraSettingsCacheCleanlabel),CACHE_CLEAN_LABEL); + gtk_button_set_label(GTK_BUTTON(widgets->extraSettingsLaunchPackageManagerButton),LAUNCH_PACKAGE_MANAGER_LABEL); + + gtk_label_set_text(GTK_LABEL(widgets->headerLoadConfigLabel),LOAD_LABEL); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerLoadGlobalConfigButton),LOAD_GLOBAL_LABEL); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerLoadLocalConfigButton),LOAD_LOCAL_LABEL); + + gtk_label_set_text(GTK_LABEL(widgets->headerSaveConfigLabel),SAVE_LABEL); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerSaveGlobalLocalConfigButton),SAVE_LABEL); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerSaveGlobalConfigButton),SAVE_GLOBAL_LABEL); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerSaveLocalConfigButton),SAVE_LOCAL_LABEL); + + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerDocumentationButton),DOCUMENTATION_LABEL); + gtk_menu_item_set_label(GTK_MENU_ITEM(widgets->headerAboutButton),ABOUT_LABEL); + + gtk_button_set_label(GTK_BUTTON(widgets->mainCheckForUpdatesButton),CHECK_FOR_UPDATES_LABEL); @@ -158,29 +303,100 @@ main_window *setup_window(){ GtkWidget *Overlay = yon_gtk_builder_get_widget(widgets->builder,"HeadOverlay"); GtkWidget *UnderNoteOverlay = yon_gtk_builder_get_widget(widgets->builder,"UnderNoteOverlay"); - GtkWidget *checkForUpdatesButton = yon_gtk_builder_get_widget(widgets->builder,"checkForUpdatesButton"); GtkWidget *headLabel = yon_gtk_builder_get_widget(widgets->builder,"headLabel"); + GtkWidget *headInfoLabel = yon_gtk_builder_get_widget(widgets->builder,"headInfoLabel"); yon_ubl_header_setup(Overlay,Header,Image,image_path); - gtk_overlay_add_overlay(GTK_OVERLAY(UnderNoteOverlay),checkForUpdatesButton); + gtk_overlay_add_overlay(GTK_OVERLAY(UnderNoteOverlay),widgets->mainCheckForUpdatesButton); - gtk_label_set_text(GTK_LABEL(headLabel),_("System update parameter configuration")); + gtk_label_set_text(GTK_LABEL(headLabel),TITLE_LABEL); + gtk_label_set_text(GTK_LABEL(headInfoLabel),TITLE_INFO_LABEL); gtk_widget_show_all(widgets->window); + render.box=widgets->statusBox; + render.icon=widgets->statusIcon; + render.label=widgets->statusLabel; + yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id); - g_signal_connect(G_OBJECT(widgets->repositoriesSettingsCreateButton), "clicked", G_CALLBACK(on_repo_window_open), NULL); - g_signal_connect(G_OBJECT(widgets->repositoriesSettingsEditButton), "clicked", G_CALLBACK(on_repo_window_open), NULL); + g_signal_connect(G_OBJECT(widgets->repositoriesSettingsCreateButton), "clicked", G_CALLBACK(on_repo_window_open_create), NULL); + g_signal_connect(G_OBJECT(widgets->repositoriesSettingsEditButton), "clicked", G_CALLBACK(on_repo_window_open_edit), widgets->repositoriesSettingsRepositoriesTreeView); + g_signal_connect(G_OBJECT(widgets->repositoriesSettingsDeleteButton), "clicked", G_CALLBACK(on_repos_delete), widgets->repositoriesSettingsRepositoriesTreeView); g_signal_connect(G_OBJECT(widgets->headerAboutButton), "activate", G_CALLBACK(on_about), NULL); g_signal_connect(G_OBJECT(widgets->window), "destroy", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(G_OBJECT(widgets->headerDocumentationButton), "activate", G_CALLBACK(on_open_documentation_confirmation), WIKI_LINK); } int main(int argc, char *argv[]){ local=setlocale(LC_ALL, ""); textdomain (LocaleName); + init(NULL); + int option_index=0; + int show_help=0; + { + struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"version", 0, 0, 'V'}, + {"lock-help", 0,0, 1}, + {"lock-save", 0,0, 2}, + {"lock-save-local", 0,0, 3}, + {"lock-save-global", 0,0, 4}, + {"lock-load-global", 0,0, 5}, + {"socket-id", 1, 0, 's'}, + {"socket-ext-id", 1,0, 'e'}, + {"socket-trd-id", 1,0, 't'}, + { NULL, 0, NULL, 0 } + }; + for (int i=0;i +#include #include "ubl-utils.h" #include #include #include #include #include +#include +#include +#include "ubl-settings-cmake.h" +#ifdef WEBKIT_FOUND + #include +#endif +#include "ubl-settings-update-strings.h" + +#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-update" #define _(String) gettext(String) @@ -19,12 +29,35 @@ string version_application = "1.2"; char *local; +typedef struct { + int always_open_documentation; + int win_pos_x; + int win_pos_y; + int win_width; + int win_height; + + int socket_id; + int load_socket_id; + int save_socket_id; + + int lock_help; + int lock_save_local; + int lock_save_global; + int lock_load_global; + + GtkListStore *list; +} config; + typedef struct { GtkWidget *window; GtkBuilder *builder; GtkWidget *HeaderTopic; + GtkWidget *PlugBox; + GtkWidget *LeftBox; + GtkWidget *RightBox; + GtkWidget *generalSettingsTabLabel; GtkWidget *repositoriesSettingsTabLabel; GtkWidget *extraSettingsTabLabel; @@ -44,6 +77,7 @@ typedef struct { GtkWidget *repositoriesSettingsRepositoriesTreeView; GtkTreeViewColumn *repositoriesSettingsEnabledColumn; GtkTreeViewColumn *repositoriesSettingsURIColumn; + GtkTreeViewColumn *repositoriesSettingsDistributionColumn; GtkWidget *extraSettingsPackageManagerLabel; GtkWidget *extraSettingsPackageManagerEntry; @@ -67,26 +101,41 @@ typedef struct { GtkWidget *mainCheckForUpdatesButton; + GtkWidget *statusBox; + GtkWidget *statusIcon; + GtkWidget *statusLabel; + } main_window; typedef struct { GtkWidget *window; GtkBuilder *builder; + GtkListStore *list; GtkWidget *repoTypeLabel; GtkWidget *repoTypeEntry; - GtkWidget *repoURILabel; - GtkWidget *repoURIMeanLabel; GtkWidget *repoDistributionLabel; - GtkWidget *repoDistributionMeanLabel; - GtkWidget *repoSectionsLabel; - GtkWidget *repoSectionsMeanlabel; + GtkWidget *repoDistributionEntry; GtkWidget *repoCancelButton; GtkWidget *repoAcceptButton; + GtkWidget *tree; } repo_window; +typedef struct { + GtkWidget *Window; + + GtkWidget *HatText; + GtkWidget *HeaderText; + GtkWidget *InfoText; + GtkWidget *AlwaysOpenCheck; + + GtkWidget *CloseButton; + GtkWidget *AcceptButton; +} documentation_confirmation_window; + void on_repo_window_open(GtkWidget *self); -main_window *setup_window(); -repo_window *setup_repo_window(); \ No newline at end of file +void on_repo_window_open_edit(GtkWidget *self, GtkWidget *tree); +repo_window *on_repo_window_open_create(GtkWidget *self); +main_window *setup_window(); \ No newline at end of file diff --git a/source/ubl-settings-update.h.in b/source/ubl-settings-update.h.in new file mode 100644 index 0000000..d4623a7 --- /dev/null +++ b/source/ubl-settings-update.h.in @@ -0,0 +1 @@ +#cmakedefine WEBKIT_FOUND diff --git a/source/ubl-utils.c b/source/ubl-utils.c index ed01b97..1565aa3 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -1,397 +1,632 @@ #include "ubl-utils.h" -#ifndef UBL_UTILS - -typedef enum { - DICTIONARY_ACTION_WIDGETS_TYPE, - DICTIONARY_IVGRAPHICALS_TYPE, - DICTIONARY_OTHER_TYPE - -} DICT_TYPE; - -typedef struct dictionary { - char *key; - void *data; - struct dictionary *next; - struct dictionary *prev; - struct dictionary *first; - DICT_TYPE data_type; -} dictionary; - -typedef struct apps{ - char *Name; - int Type; - char *Categories; - char *Exec; - char *Icon; - int Pluggable; - int DualPluggable; - } apps; - -typedef struct { - char *command; - int *exitcode; -} thread_output; -#ifdef __GTK_H__ -typedef struct IVGrapgicals{ - char *sectionName; - char *categories; - GtkListStore *LV; - GtkWidget *Box; - GtkWidget *IV; - GtkWidget *label; - GtkWidget *sep; - GtkCellRendererPixbuf *iconRender; -} IVGraphicals; -#endif -#endif +#include "ubl-settings-cmake.h" +#ifdef WEBKIT_FOUND + #include +#endif +// dictionary functions - -//dictionary functions - -/** - * yon_dictionary_create_empty: - * Creates and returns empty dictionary -*/ -dictionary *yon_dictionary_create_empty(){ - dictionary *dict=malloc(sizeof(dictionary)); - dict->data=NULL; - dict->key=NULL; - dict->next=NULL; - dict->prev=NULL; - dict->first=dict; - dict->data_type=DICTIONARY_OTHER_TYPE; +/**[EN] + * yon_dictionary_create_empty(): + * Creates and returns empty dictionary + */ +dictionary *yon_dictionary_create_empty() +{ + dictionary *dict = malloc(sizeof(dictionary)); + dict->data = NULL; + dict->key = NULL; + dict->next = NULL; + dict->prev = NULL; + dict->first = dict; + dict->data_type = DICTIONARY_OTHER_TYPE; return dict; } -void yon_dictionary_switch_to_last(dictionary **dict){ - if ((*dict)->next!=NULL) - for ((*dict)=(*dict)->first;(*dict)->next!=NULL;(*dict)=(*dict)->next){} +void yon_dictionary_switch_to_last(dictionary **dict) +{ + if ((*dict)->next != NULL) + for ((*dict) = (*dict)->first; (*dict)->next != NULL; (*dict) = (*dict)->next) + { + } } -dictionary * yon_dictionary_create_conneced(dictionary *targetdict){ - targetdict=yon_dictionary_get_last(targetdict); - targetdict->next=yon_dictionary_create_empty(); - targetdict->next->prev=targetdict; - targetdict->next->first=targetdict->first; - targetdict->next->data_type=DICTIONARY_OTHER_TYPE; +dictionary *yon_dictionary_create_conneced(dictionary *targetdict) +{ + targetdict = yon_dictionary_get_last(targetdict); + targetdict->next = yon_dictionary_create_empty(); + targetdict->next->prev = targetdict; + targetdict->next->first = targetdict->first; + targetdict->next->data_type = DICTIONARY_OTHER_TYPE; return targetdict->next; } -dictionary *yon_dictionary_get_last(dictionary *dict){ - dictionary *dct=NULL; - for (dct=dict->first;dct->next!=NULL;dct=dct->next){} +dictionary *yon_dictionary_get_last(dictionary *dict) +{ + dictionary *dct = NULL; + for (dct = dict->first; dct->next != NULL; dct = dct->next) + { + } return dct; } -dictionary *yon_dictionary_switch_places(dictionary *dict,int aim){ - if (aim<0){ - if (dict->prev){ - if (dict->prev->prev){ - dictionary *next = dict->next,*prev=dict->prev,*preprev=prev->prev; - if (next){ - preprev->next=dict; - dict->prev=preprev; - dict->next=prev; - prev->prev=dict; - prev->next=next; - next->prev=prev; - } else { - preprev->next=dict; - dict->prev=preprev; - dict->next=prev; - prev->prev=dict; - prev->next=NULL; +dictionary *yon_dictionary_switch_places(dictionary *dict, int aim) +{ + if (aim < 0) + { + if (dict->prev) + { + if (dict->prev->prev) + { + dictionary *next = dict->next, *prev = dict->prev, *preprev = prev->prev; + if (next) + { + preprev->next = dict; + dict->prev = preprev; + dict->next = prev; + prev->prev = dict; + prev->next = next; + next->prev = prev; + } + else + { + preprev->next = dict; + dict->prev = preprev; + dict->next = prev; + prev->prev = dict; + prev->next = NULL; } return prev; - } else { - dictionary *next = dict->next,*prev=dict->prev; - if (next){ - yon_dictionary_make_first(dict); - dict->prev=NULL; - dict->next=prev; - prev->prev=dict; - prev->next=next; - next->prev=prev; - } else { - dict->prev=NULL; - dict->next=prev; - prev->prev=dict; - prev->next=NULL; } - return prev; + else + { + dictionary *next = dict->next, *prev = dict->prev; + if (next) + { + yon_dictionary_make_first(dict); + dict->prev = NULL; + dict->next = prev; + prev->prev = dict; + prev->next = next; + next->prev = prev; + } + else + { + dict->prev = NULL; + dict->next = prev; + prev->prev = dict; + prev->next = NULL; + } + return prev; } } - } else if (aim>0){ - if (dict->next){ - if (dict->next->next){ - dictionary *next = dict->next,*prev=dict->prev,*afnext=next->next; - if (prev){ - prev->next=next; - next->prev=prev; - next->next=dict; - dict->prev=next; - dict->next=afnext; - afnext->prev=dict; - } else { + } + else if (aim > 0) + { + if (dict->next) + { + if (dict->next->next) + { + dictionary *next = dict->next, *prev = dict->prev, *afnext = next->next; + if (prev) + { + prev->next = next; + next->prev = prev; + next->next = dict; + dict->prev = next; + dict->next = afnext; + afnext->prev = dict; + } + else + { yon_dictionary_make_first(next); - next->prev=NULL; - next->next=dict; - dict->prev=next; - dict->next=afnext; - afnext->prev=dict; + next->prev = NULL; + next->next = dict; + dict->prev = next; + dict->next = afnext; + afnext->prev = dict; } return next; - } else { - dictionary *next = dict->next,*prev=dict->prev; - if (prev){ - prev->next=next; - next->prev=prev; - next->next=dict; - dict->prev=next; - dict->next=NULL; - } else { - next->prev=NULL; - next->next=dict; - dict->prev=next; - dict->next=NULL; + } + else + { + dictionary *next = dict->next, *prev = dict->prev; + if (prev) + { + prev->next = next; + next->prev = prev; + next->next = dict; + dict->prev = next; + dict->next = NULL; + } + else + { + next->prev = NULL; + next->next = dict; + dict->prev = next; + dict->next = NULL; } } } } } -void yon_dictionary_make_first(dictionary *dict){ - for (dictionary *dct=dict->first;dct!=NULL;dct=dct->next){ - dct->first=dict; +void yon_dictionary_make_first(dictionary *dict) +{ + for (dictionary *dct = dict->first; dct != NULL; dct = dct->next) + { + dct->first = dict; } } -void yon_dictionary_make_nth(dictionary *dict, int nth){ - dictionary *dct=dict->first; - for (int i=0;inext;} +void yon_dictionary_make_nth(dictionary *dict, int nth) +{ + dictionary *dct = dict->first; + for (int i = 0; i < nth; i++) + { + if (dct == NULL) + return; + else + dct = dct->next; + } yon_dictionary_rip(dict); - dictionary *prev=dct->prev; - prev->next=dict; - dict->prev=prev; - dict->next=dct; - dct->prev=dict; -} - -dictionary *yon_dictionary_create_with_data(char *key, void *data){ - dictionary *dct=yon_dictionary_create_empty(); - dct->key=yon_char_new(key); - dct->data=data; - dct->data_type=DICTIONARY_OTHER_TYPE; + dictionary *prev = dct->prev; + prev->next = dict; + dict->prev = prev; + dict->next = dct; + dct->prev = dict; +} + +dictionary *yon_dictionary_create_with_data(char *key, void *data) +{ + dictionary *dct = yon_dictionary_create_empty(); + dct->key = yon_char_new(key); + dct->data = data; + dct->data_type = DICTIONARY_OTHER_TYPE; return dct; } -dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data){ - dictionary *dct=yon_dictionary_create_conneced(dict); - dct->key=yon_char_new(key); - dct->data=data; - dct->data_type=DICTIONARY_OTHER_TYPE; +/** void *yon_dictionary_free_all(dictionary *dictionary,void *data_manipulation) + * [EN] + * Frees whole [dictionary] and activates [data_manipulation] function if not NULL with [dictionary]->data argument for each dictionary. + * [RU] + * Освобождает память для всех элементов словаря [dictionary] и активирует функцию [data_manipulation], если она была передана, с аргументом [dictionary]->data на каждый элемент словаря. +*/ +void *yon_dictionary_free_all(dictionary *dictionary_to_free,void (*data_manipulation)(void*)){ + dictionary *dict=NULL; + for_dictionaries(dict,dictionary_to_free){ + if(data_manipulation) + data_manipulation(dict->data); + if(dict->prev) + free(dict->prev); + } + free(dict); + return NULL; +} + +dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data) +{ + dictionary *dct = yon_dictionary_create_conneced(dict); + dct->key = yon_char_new(key); + dct->data = data; + dct->data_type = DICTIONARY_OTHER_TYPE; return dct; } -dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect){ - dictionary *dict=yon_dictionary_get_last(old); - dict->next=toconnect; - toconnect->prev=dict; - toconnect->first=dict->first; +dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect) +{ + dictionary *dict = yon_dictionary_get_last(old); + dict->next = toconnect; + toconnect->prev = dict; + toconnect->first = dict->first; return toconnect; } -dictionary *yon_dictionary_find(dictionary **dict, char *key){ - dictionary *dct=*dict; - for (dictionary *pointer=dct->first;pointer!=NULL;pointer=pointer->next){ - if (strcmp(pointer->key,key)==0){ - *dict=pointer; +dictionary *yon_dictionary_find(dictionary **dict, char *key) +{ + dictionary *dct = *dict; + for (dictionary *pointer = dct->first; pointer != NULL; pointer = pointer->next) + { + if (strcmp(pointer->key, key) == 0) + { + *dict = pointer; return pointer; } } return NULL; } - -dictionary *yon_dictionary_rip(dictionary *dict){ - if (!dict->next){ - dictionary *prev=dict->prev; - if (prev){ - prev->next=NULL; - return prev; - } else return dict; +dictionary *yon_dictionary_rip(dictionary *dict) +{ + if (!dict->next&&!dict->prev) return NULL; + else if (!dict->next) + { + dictionary *prev = dict->prev; + if (prev) + { + prev->next = NULL; + return prev; + } + else + return dict; } - else if (!dict->prev){ - dictionary *next=dict->next; - if (next){ + else if (!dict->prev) + { + dictionary *next = dict->next; + if (next) + { yon_dictionary_make_first(next); - next->prev=NULL; + next->prev = NULL; return next; } - else return dict; + else + return dict; } - else { - dictionary *next=dict->next, *prev=dict->prev; - next->prev=prev; - prev->next=next; + else + { + dictionary *next = dict->next, *prev = dict->prev; + next->prev = prev; + prev->next = next; return next; } } -dictionary *yon_dictionary_get_nth(dictionary *dict, int place){ - dict=dict->first; - for (int i=0;inext; - if (dict) return dict; - else return NULL; +dictionary *yon_dictionary_get_nth(dictionary *dict, int place) +{ + if (dict){ + dict = dict->first; + int i = 0; + for (i = 0; i < place; i++) + if (dict->next) + dict = dict->next; + else + break; + if (i == place) + return dict; + else + return NULL; + } else return NULL; } -//char functions +// char functions -/** +/**[EN] + * * creates new char string by combining two char strings. -*/ -char *yon_char_get_augumented(char *source, char *append){ - if (source&&append){ - int size=strlen(source)+strlen(append)+1; - char *final=malloc(size); - memset(final,0,size); - if (strstr(source,"%%")) - sprintf(final,source,append); + */ +char *yon_char_get_augumented(char *source, char *append) +{ + if (source && append) + { + int size = strlen(source) + strlen(append) + 1; + char *final = malloc(size); + memset(final, 0, size); + if (strstr(source, "%%")) + sprintf(final, source, append); + else + sprintf(final, "%s%s", source, append); + return final; + } else - sprintf(final,"%s%s",source,append); - return final; - } else return NULL; } -/** +/**[EN] + * * creates new char string by copying another char. -*/ -char *yon_char_new(char *chr){ - char *newchar=malloc(strlen(chr)+1); - memset(newchar,0,strlen(chr)+1); - memcpy(newchar,chr,strlen(chr)); - return newchar; + */ +char *yon_char_new(char *chr) +{ + if (chr){ + char *newchar = malloc(strlen(chr) + 1); + memset(newchar, 0, strlen(chr) + 1); + memcpy(newchar, chr, strlen(chr)); + return newchar; + } else + return NULL; } -/** +// char *yon_char_unite(char *source, ...) + +char *yon_char_unite(char *source, ...){ + va_list arglist; + char *new_char=NULL; + char *unite_char=NULL; + new_char=yon_char_new(source); + va_start(arglist,source); + unite_char = va_arg(arglist,char*); + while(unite_char){ + new_char = yon_char_get_augumented(new_char,unite_char); + unite_char = va_arg(arglist,char*); + } + va_end(arglist); + return new_char; +} + +/**[EN] + * * cuts source string by size length from startpos position. -*/ -char *yon_cut(char *source, int size, int startpos){ - char *cut=NULL; - cut=malloc(size+1); - memset(cut,0,size+1); - memcpy(cut,source+startpos,size); + */ +char *yon_cut(char *source, int size, int startpos) +{ + char *cut = NULL; + cut = malloc(size + 1); + memset(cut, 0, size + 1); + memcpy(cut, source + startpos, size); return cut; } -/** +/**[EN] + * * divides source string in dividepos position, * returning left part of divided string and * inserting right part to source string. -*/ -char *yon_char_divide(char *source, int dividepos){ - char *cut=malloc(dividepos+1); - memset(cut,0,dividepos+1); - memcpy(cut,source,dividepos); - char *left=malloc(strlen(source)-strlen(cut)); - memset(left,0,strlen(source)-strlen(cut)); - memcpy(left,source+dividepos+1,(strlen(source)-dividepos)); - memset(source,0,strlen(source)); - memcpy(source,left,strlen(left)); + */ +char *yon_char_divide(char *source, int dividepos) +{ + char *cut = malloc(dividepos + 1); + memset(cut, 0, dividepos + 1); + memcpy(cut, source, dividepos); + char *left = malloc(strlen(source) - strlen(cut)); + memset(left, 0, strlen(source) - strlen(cut)); + memcpy(left, source + dividepos + 1, (strlen(source) - dividepos)); + memset(source, 0, strlen(source)); + memcpy(source, left, strlen(left)); return cut; } -/** - * searches string dividepos in source string and divides it, +int yon_char_find_count(char *source, char *find){ + char *working_string=yon_char_new(source); + int i=0; + int size=0; + int pos=0; + config_str rtn = yon_char_parse(working_string,&size,"\n"); + for (int j=0;j 10; i++) + { + convert_check = convert_check / 10; + } + char *ch = malloc(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); + } + return source; + } +} + +/**[EN] + * char **yon_char_parse(char *parameters, int *size, char *divider) + * Parses string [parameters], divided by [divider], + * then returns parsed string array and sets [size] to + * size of returned array */ -char *yon_char_from_int(int int_to_convert){ +char **yon_char_parse(char *parameters, int *size, char *divider){ + char **string=NULL; int i=1; - float convert_check=(float)int_to_convert; - for (i=1;convert_check>10;i++){ - convert_check=convert_check/10; + string=malloc(sizeof(char*)); + char *paramline=yon_char_new(parameters); + char *param; + while ((param=yon_char_divide_search(paramline,divider,1))){ + string=realloc(string,sizeof(char*)*i); + string[i-1]=yon_char_new(param); + i++; + if (strcmp(param,paramline)==0) break; } - char *ch=malloc(i*sizeof(char)+1); - sprintf(ch,"%d",int_to_convert); - return ch; + 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){ + 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[i]=yon_char_new(char_string[i]); + sz++; + } + + } + *size=sz; + return new_char_parsed; +} -//parsing functions +/**[EN] + * + * Checks if [parameters] string array of length [size] + * has [param] element; +*/ +int yon_char_parsed_check_exist(char **parameters, int size, char *param){ + + for (int i=0;id_name); - file=fopen(path,"r"); - if (strlen(de->d_name)>9) + char *path = yon_char_get_augumented(DesktopPath, de->d_name); + file = fopen(path, "r"); + if (strlen(de->d_name) > 9) { - char *extension=strstr(path,"."); - if (extension!=NULL) + char *extension = strstr(path, "."); + if (extension != NULL) { - if (strcmp(extension,".desktop")==0) + if (strcmp(extension, ".desktop") == 0) { apps tempapp; - GKeyFile *gfile=g_key_file_new(); - GError *err=NULL; - g_key_file_load_from_file(gfile,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL); - char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",&err); - if (err){ - printf("%s\n",err->message); + GKeyFile *gfile = g_key_file_new(); + GError *err = NULL; + g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL); + char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err); + if (err) + { + printf("%s\n", err->message); } - if (strcmp(Type,"Application")==0) tempapp.Type=1; else if (strcmp(Type,"pyApplication")==0) tempapp.Type=2; else continue; - tempapp.Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL); - if (tempapp.Name==NULL) continue; - tempapp.Categories=g_key_file_get_string(gfile,"Desktop Entry", "Categories",NULL); - if (tempapp.Categories==NULL) continue; - tempapp.Exec=g_key_file_get_string(gfile,"Desktop Entry", "Exec",NULL); - if (tempapp.Exec==NULL) continue; - tempapp.Icon=g_key_file_get_string(gfile,"Desktop Entry", "Icon",NULL); - if (tempapp.Icon==NULL) continue; - tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "Pluggable",NULL); - if (!tempapp.Pluggable) tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",NULL); - if (tempapp.Pluggable) tempapp.DualPluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL); - if (g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBL-SettingsManager-Hidden",NULL)==0) - if (size==0){ - applist=(apps*)malloc(size+1*sizeof(apps)); - applist[0].Name=yon_char_new(tempapp.Name); - applist[0].Categories=yon_char_new(tempapp.Categories); - applist[0].Exec=yon_char_new(tempapp.Exec); - applist[0].Icon=yon_char_new(tempapp.Icon); - applist[0].Type=tempapp.Type; - applist[0].Pluggable=tempapp.Pluggable; - applist[0].DualPluggable=tempapp.DualPluggable; + if (strcmp(Type, "Application") == 0) + tempapp.Type = 1; + else if (strcmp(Type, "pyApplication") == 0) + tempapp.Type = 2; + else + continue; + tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); + if (tempapp.Name == NULL) + continue; + tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); + if (tempapp.Categories == NULL) + continue; + tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); + if (tempapp.Exec == NULL) + continue; + tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); + if (tempapp.Icon == NULL) + continue; + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); + if (!tempapp.Pluggable) + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); + if (tempapp.Pluggable) + tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); + if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) + if (size == 0) + { + applist = (apps *)malloc(size + 1 * sizeof(apps)); + applist[0].Name = yon_char_new(tempapp.Name); + applist[0].Categories = yon_char_new(tempapp.Categories); + applist[0].Exec = yon_char_new(tempapp.Exec); + applist[0].Icon = yon_char_new(tempapp.Icon); + applist[0].Type = tempapp.Type; + applist[0].Pluggable = tempapp.Pluggable; + applist[0].DualPluggable = tempapp.DualPluggable; size++; - } else { - applist=(apps*)realloc(applist,(size+1)*sizeof(apps)); - applist[size].Name=yon_char_new(tempapp.Name); - applist[size].Categories=yon_char_new(tempapp.Categories); - applist[size].Exec=yon_char_new(tempapp.Exec); - applist[size].Icon=yon_char_new(tempapp.Icon); - applist[size].Pluggable=tempapp.Pluggable; - applist[size].DualPluggable=tempapp.DualPluggable; - applist[size].Type=tempapp.Type; + } + else + { + applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); + applist[size].Name = yon_char_new(tempapp.Name); + applist[size].Categories = yon_char_new(tempapp.Categories); + applist[size].Exec = yon_char_new(tempapp.Exec); + applist[size].Icon = yon_char_new(tempapp.Icon); + applist[size].Pluggable = tempapp.Pluggable; + applist[size].DualPluggable = tempapp.DualPluggable; + applist[size].Type = tempapp.Type; size++; } } @@ -399,201 +634,427 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef){ } } } - *sizef=size; + *sizef = size; return applist; }; - -void yon_apps_sort(apps *applist,int size){ +void yon_apps_sort(apps *applist, int size) +{ apps tmp; - if (size>2) + if (size > 2) { - for (int i=1;i0){ + *str_len = i; + return output_strings; + } else{ + *str_len=-1; + return NULL; + } +} -//terminal-using functions +/**[EN] + * int yon_config_save(char *command) + * Saves config with [command] + * [RU] +*/ +int yon_config_save(char *command) +{ + FILE *output = popen(command, "r"); + return 1; +} +/**[EN] + * char *yon_config_get_parameter(config parameters, int size, char *param) + * Gets parameter from parameter list; + * + * [RU] +*/ +char *yon_config_get_parameter(config_str parameters, int size, char *param) +{ + if (param[0]==' ') + yon_char_divide_search(param," ",-1); + param=yon_char_divide_search(yon_char_new(param)," ",-1); + + char *str = NULL; + for (int j = 0; j < size; j++) + { + char *name = yon_char_divide_search(yon_char_new(parameters[j]), "=", 1); + if (name) + { + if (strcmp(name, param) == 0) + { + str = yon_char_divide_search(yon_char_new(parameters[j]), "\n", 1); + if (strcmp(str, "") != 0 && strcmp(str, "(null)") != 0) + return str; + else + return NULL; + } + } + } + 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)); +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); + pthread_create(&thread_id, NULL, (void *)yon_launch, thread); return *thread->exitcode; }; - -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); +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); 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); + 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; }; - -int yon_launch(thread_output *thread){ - int a=0; - a=system(thread->command); - *thread->exitcode=a; +int yon_launch(thread_output *thread) +{ + int a = 0; + a = system(thread->command); + *thread->exitcode = a; return *thread->exitcode; } +// Gtk functions -//Gtk functions #ifdef __GTK_H__ -// dictionary *yon_gtk_app_chooser_create(GtkBuilder *builder){ -// GtkWidget *chooserWindow=gtk_window_new(GTK_WINDOW_TOPLEVEL); -// GtkWidget *Box=gtk_box_new(GTK_ORIENTATION_VERTICAL,5); -// GtkWidget *Frame=gtk_frame_new(""); -// GtkWidget *Scroll=gtk_scrolled_window_new(NULL, gtk_adjustment_new(0,0,10000,1,10,100)); -// GtkWidget *PackBox=gtk_box_new(GTK_ORIENTATION_VERTICAL,5); -// GtkWidget *ButtonsBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); -// GtkWidget *ButtonsPlaceBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); - -// GtkWidget *CancelButton=gtk_button_new_with_label("Cancel"); -// GtkWidget *AcceptButton=gtk_button_new_with_label("Accept"); -// gtk_container_add(GTK_CONTAINER(chooserWindow),Box); -// gtk_box_pack_start(GTK_BOX(Box),Frame,1,1,0); -// gtk_container_add(GTK_CONTAINER(Frame),PackBox); -// gtk_box_pack_start(GTK_BOX(Box),ButtonsBox,0,0,0); -// gtk_box_pack_end(GTK_BOX(ButtonsBox),ButtonsPlaceBox,0,0,0); -// gtk_box_pack_end(GTK_BOX(ButtonsPlaceBox),AcceptButton,0,0,0); -// gtk_box_pack_end(GTK_BOX(ButtonsPlaceBox),CancelButton,0,0,0); -// gtk_box_pack_start(GTK_BOX(PackBox),(GtkWidget*)yon_gtk_app_chooser_apps_create(builder),0,0,0); -// gtk_widget_show_all(chooserWindow); -// } +#ifdef VTE_TERMINAL /** - * yon_iv_segment_create: - * connect_to - dictionary, in the end of which new one will be connected; - * name - name of this segment, renders on label; - * categories - desktop file categories that application NEEDS to have to render in that category; - * segment_icon_name - icon name for this section; - * builder - newly allocated builder with glade file connected where template widgets are stored: - * - templateAppsIconView - setted up icon view; - * - templateAppsPack - setted up container for every template widget; - * - templateAppsImage - image for rendering section image; - * - templateAppsLabel - label for rendering section name; + * void yon_terminal_integrated_launch(GtkWidget *place_to_show, 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]. */ -// dictionary *yon_iv_segment_create(dictionary *connect_to, char *name, char *categories, char *segment_icon_name){ -// IVSegment *segment=malloc(sizeof(IVSegment)); -// segment->name=name; -// segment->categories=categories; -// GtkBuilder *builder=gtk_builder_new_from_string(return_app_string(),-1); -// GtkWidget *iv=yon_gtk_builder_get_widget(builder,"templateAppsIconView"); -// GtkWidget *expander=yon_gtk_builder_get_widget(builder,"templateAppsPack"); -// GtkWidget *image=yon_gtk_builder_get_widget(builder,"templateAppsImage"); -// GtkWidget *label=yon_gtk_builder_get_widget(builder,"templateAppsLabel"); -// GtkIconTheme *theme=gtk_icon_theme_get_default(); -// gtk_image_set_from_pixbuf(GTK_IMAGE(image),gtk_icon_theme_load_icon_for_scale(theme,segment_icon_name,20,1,GTK_ICON_LOOKUP_FORCE_SVG,NULL)); -// gtk_label_set_text(GTK_LABEL(label),name); -// GtkListStore *ls=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore5")); -// // g_signal_connect(G_OBJECT(iv), "item-activated", G_CALLBACK(on_activate), videoconfig.applist); -// segment->Expander=expander; -// segment->IV=iv; -// segment->LS=ls; -// segment->Image=image; -// dictionary *dict=NULL; -// if (connect_to) { -// // connect_to=yon_dictionary_get_last(connect_to); -// dict=yon_dictionary_create_with_data_connected(connect_to,name,segment); -// } else -// dict=yon_dictionary_create_with_data(name,segment); -// return dict; -// } - -// GtkWidget *yon_gtk_app_chooser_apps_create(){ -// GtkWidget *Box=gtk_box_new(GTK_ORIENTATION_VERTICAL,0); -// dictionary *IVS=yon_iv_segment_create(NULL, "Graphics", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "Tools", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "Internet", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "Multimedia", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "Settings", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "Education", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "Office", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "Other", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "Development", "", "dialog-yes-symbolic"); -// yon_iv_segment_create(IVS, "System", "", "dialog-yes-symbolic"); -// dictionary *nd; -// for_dictionaries(nd,IVS){ -// gtk_box_pack_start(GTK_BOX(Box),((IVSegment*)nd->data)->Expander,0,0,0); -// } -// return Box; - -// } - -// GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data){ -// GtkWidget *socket; -// socket = gtk_socket_new(); -// g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(yon_on_plug_added),data); -// g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(yon_on_plug_removed),data); -// g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(yon_on_plug_removed),data); -// gtk_box_pack_start(GTK_BOX(container),socket,1,1,0); -// return socket; -// }; - -int yon_dictionary_gtk_pack_start_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_start(GTK_BOX(destination),(GtkWidget*)dct->data,expand,fill,padding); +void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument){ + 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); + 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); + vte_terminal_spawn_async(VTE_TERMINAL(terminal), + VTE_PTY_DEFAULT, + NULL, + install_command, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + NULL, + NULL); + vte_pty_spawn_async(pty, + NULL, + install_command, + 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(widgets->TerminalRevealer); } + +#endif + +int yon_gtk_combo_box_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); + } 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); +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); } 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(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_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *IconName, char* StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass){ - GtkIconTheme *ictheme=gtk_icon_theme_get_default(); - GError *err=NULL; - gtk_image_set_from_pixbuf(GTK_IMAGE(StatusIcon),gtk_icon_theme_load_icon_for_scale(ictheme,IconName,25,1,GTK_ICON_LOOKUP_FORCE_SIZE,&err)); - if (err){ - printf("%s\n",err->message); +/** + * +*/ +void _yon_ubl_status_box_render(render_data *datav) +{ + render_data data = *(render_data*)datav; + GtkIconTheme *ictheme = gtk_icon_theme_get_default(); + GError *err = NULL; + if (err) + { + printf("%s\n", err->message); g_error_free(err); } - gtk_label_set_text(GTK_LABEL(StatusLabel),StatusText); - if (BackgroundClass==BACKGROUND_IMAGE_SUCCESS_TYPE){ - gtk_style_context_add_class(gtk_widget_get_style_context(StatusBox),"boxInfoMessOK"); - } else if (BackgroundClass==BACKGROUND_IMAGE_FAIL_TYPE){ - gtk_style_context_add_class(gtk_widget_get_style_context(StatusBox),"boxInfoMessError"); + if (data.type == BACKGROUND_IMAGE_SUCCESS_TYPE||! data.type) + { + gtk_style_context_remove_class(gtk_widget_get_style_context(data.box), "boxInfoMessError"); + gtk_style_context_add_class(gtk_widget_get_style_context(data.box), "boxInfoMessOK"); + gtk_image_set_from_pixbuf(GTK_IMAGE(data.icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err)); + } + else if (data.type == BACKGROUND_IMAGE_FAIL_TYPE) + { + gtk_style_context_remove_class(gtk_widget_get_style_context(data.box), "boxInfoMessOK"); + gtk_style_context_add_class(gtk_widget_get_style_context(data.box), "boxInfoMessError"); + gtk_image_set_from_pixbuf(GTK_IMAGE(data.icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err)); } + if (data.text_to_render) + gtk_label_set_text(GTK_LABEL(data.label), data.text_to_render); } + +/**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) + * [EN] + * Set up plugs for using with GtkSockets insine ubl-settings-manager. + * [main_window] is container widget, which holds main application functionality. + * [left_window] is container widget, which holds widgets, have to be shown at left part of ubl-settings-manager header. + * [right_window] is container widget, which holds widgets, have to be shown at right part of ubl-settings-manager header. + * [socket_main_id] is id of socket for [main_window]. + * [socket_left_id] is id of socket for [left_window]. + * [socket_right_id] is id of socket for [right_window]. + * [RU] + * Настраивает плаги для работы с сокетами в утилите ubl-settings-manager. + * [main_window] - контейнер основного интерфейса приложения. + * [left_window] - контейнер для виджетов которые должны отображаться в левой части шапки ubl-settings-manager. + * [right_window] - контейнер для виджетов которые должны отображаться в правой части шапки ubl-settings-manager. + * [socket_main_id] - id сокета для [main_window]. + * [socket_left_id] - id сокета для [left_window]. + * [socket_right_id] - id сокета для [right_window]. +*/ +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){ + if (main_window&&socket_main_id>-1){ + gtk_widget_hide(gtk_widget_get_toplevel(main_window)); + GtkWidget *plug_main=gtk_plug_new(socket_main_id); + GtkWidget *plug_left=NULL; + GtkWidget *plug_right=NULL; + GtkWidget *box=NULL; + g_signal_connect(G_OBJECT(plug_main), "destroy", G_CALLBACK(gtk_main_quit),NULL); + if (socket_left_id>-1&&left_window){ + plug_left=gtk_plug_new(socket_left_id); + g_object_ref(left_window); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(left_window)),left_window); + gtk_container_add(GTK_CONTAINER(plug_left),left_window); + gtk_style_context_add_class(gtk_widget_get_style_context(plug_left),"primary-toolbar"); + gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"button"); + gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"opacited"); + gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"color"); + gtk_style_context_add_class(gtk_widget_get_style_context(plug_left),"noborder"); + gtk_widget_show(plug_left); + } + else if (left_window){ + if (box==NULL){ + box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); + gtk_box_pack_start(GTK_BOX(main_window),box,0,0,5); + gtk_box_reorder_child(GTK_BOX(main_window),box,0); + gtk_widget_show(box); + } + gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"inherited"); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(left_window)),left_window); + gtk_box_pack_end(GTK_BOX(box),left_window,0,0,5); + } + if (socket_right_id>-1&&right_window){ + plug_right=gtk_plug_new(socket_right_id); + g_object_ref(right_window); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(right_window)),right_window); + gtk_container_add(GTK_CONTAINER(plug_right),right_window); + gtk_style_context_add_class(gtk_widget_get_style_context(plug_right),"primary-toolbar"); + gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"button"); + gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"opacited"); + gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"color"); + gtk_style_context_add_class(gtk_widget_get_style_context(plug_right),"noborder"); + gtk_widget_show(plug_right); + } + else if (right_window){ + if (box==NULL){ + box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); + gtk_box_pack_start(GTK_BOX(main_window),box,0,0,5); + gtk_box_reorder_child(GTK_BOX(main_window),box,0); + gtk_widget_show(box); + } + gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"inherited"); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(right_window)),right_window); + gtk_box_pack_start(GTK_BOX(box),right_window,0,0,5); + } + g_object_ref(main_window); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(main_window)),main_window); + gtk_container_add(GTK_CONTAINER(plug_main),main_window); + gtk_widget_show(plug_main); + } +} + +#ifdef WEBKIT_FOUND + +/**yon_ubl_browser_window_open(char *link, char *browser_window_name) + * [EN] + * Launches integrated browser window, named [browser_window_name] at header with [link]. + * [RU] + * Открывает встроенный браузер с именем [browser_window_name] и показываемой страницей по ссылке [link] +*/ +void yon_ubl_browser_window_open(char *link, char *browser_window_name){ + GtkWidget *browser=gtk_window_new(GTK_WINDOW_TOPLEVEL); + GtkWidget *web_place=gtk_box_new(GTK_ORIENTATION_VERTICAL,0); + GtkWidget *header=gtk_header_bar_new(); + GtkWidget *header_label=gtk_label_new(browser_window_name); + GtkWidget *WebView=webkit_web_view_new(); + gtk_container_add(GTK_CONTAINER(browser),web_place); + gtk_window_set_titlebar(GTK_WINDOW(browser),header); + gtk_window_set_title(GTK_WINDOW(browser),browser_window_name); + gtk_widget_set_size_request(browser,800,600); + gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label); + gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(header),1); + webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),link); + gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0); + gtk_widget_show_all(browser); +} +#else + +/**yon_ubl_browser_window_open(char *link, char *browser_window_name) + * [EN] + * Launches browser with [link]. + * [browser_window_name] is't used. It's needed for compatibility with webkit version of that function. + * [RU] + * Открывает браузер со страницей по ссылке [link] + * [browser_window_name] не используется. Нужна для совместимости с webkit версией этой функции. +*/ +void yon_ubl_browser_window_open(char *link, char *browser_window_name){ + char *user=getenv("SUDO_USER"); + if (!user) + user=getlogin(); + char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL); + yon_launch_app(command); +} +#endif + #endif \ No newline at end of file diff --git a/source/ubl-utils.h b/source/ubl-utils.h index 444fd93..7004cca 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -12,22 +13,36 @@ #define DesktopPath "/usr/share/applications/" -#define for_dictionaries(obj,obj1) for(obj=obj1->first;obj!=NULL;obj=obj->next) +#define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next) -typedef enum { - DICTIONARY_ACTION_WIDGETS_TYPE, - DICTIONARY_IVGRAPHICALS_TYPE, +#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) + +typedef enum +{ + #ifdef __GTK_H__ + DICTIONARY_GTK_WIDGETS_TYPE, + #endif DICTIONARY_OTHER_TYPE } DICT_TYPE; - -typedef struct { +typedef struct +{ char *command; int *exitcode; } thread_output; -typedef struct dictionary { + +typedef struct dictionary +{ char *key; void *data; struct dictionary *next; @@ -36,26 +51,41 @@ typedef struct dictionary { DICT_TYPE data_type; } dictionary; -typedef struct apps{ - char *Name; - int Type; - char *Categories; - char *Exec; - char *Icon; - int Pluggable; - int DualPluggable; - } apps; - - -//dictionary functions +typedef struct apps +{ + char *Name; + int Type; + char *Categories; + char *Exec; + char *Icon; + int Pluggable; + int DualPluggable; +} apps; + +typedef char** config_str; +// dictionary functions + +/**yon_dictionary_get_data(dictionary, type) + * [EN] + * Gets data from dictionary. + * [dictionary] is dictionary, from which data should be extracted; + * [type] is type of data, [dictionary] contains. + * [RU] + * Возвращает данные из словаря. + * [dictionary] - словарь из которого достаются данные. + * [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(); -dictionary * yon_dictionary_create_conneced(dictionary *targetdict); +dictionary *yon_dictionary_create_conneced(dictionary *targetdict); dictionary *yon_dictionary_get_last(dictionary *dict); -dictionary *yon_dictionary_switch_places(dictionary *dict,int aim); +dictionary *yon_dictionary_switch_places(dictionary *dict, int aim); void yon_dictionary_make_first(dictionary *dict); @@ -73,92 +103,195 @@ dictionary *yon_dictionary_rip(dictionary *dict); dictionary *yon_dictionary_get_nth(dictionary *dict, int place); -//char functions +void *yon_dictionary_free_all(dictionary *dictionary,void (data_manipulation)(void*)); + +// char functions char *yon_char_get_augumented(char *source, char *append); char *yon_char_new(char *chr); +char *yon_char_unite(char *source, ...); + char *yon_cut(char *source, int size, int startpos); char *yon_char_divide(char *source, int dividepos); -char *yon_char_divide_search(char *source, char* dividepos, int delete_divider); +char *yon_char_divide_search(char *source, char *dividepos, int delete_divider); char *yon_char_from_int(int int_to_convert); +char *yon_char_replace(char *source, char *find, char*replace); +char **yon_char_parse(char *parameters, int *size, char *divider); -//parsing functions +char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete); -apps *yon_apps_scan_and_parse_desktops(int *sizef); +int yon_char_parsed_check_exist(char **parameters, int size, char *param); +int yon_char_find_count(char *source, char *find); -void yon_apps_sort(apps *applist,int size); +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, ...); -apps *yon_apps_get_by_name(apps *applist,char *name, int size); +// parsing functions +apps *yon_apps_scan_and_parse_desktops(int *sizef); -//terminal-using functions +void yon_apps_sort(apps *applist, int size); +apps *yon_apps_get_by_name(apps *applist, char *name, int size); +config_str yon_config_load(char *command, int *str_len); -int yon_launch_app(char *name); +int yon_config_save(char *command); +char *yon_config_get_parameter(config_str parameters, int size, char *param); -int yon_launch_app_with_arguments(char *name, char *args); +char *yon_config_make_save_parameter_with_multiple_arguments(char *parameter_string, char *config_parameter, char *divider); + +// terminal-using functions +int yon_launch_app(char *name); + +int yon_launch_app_with_arguments(char *name, char *args); int yon_launch(thread_output *thread); -//Gtk functions +// Gtk functions #ifdef __GTK_H__ +#ifdef VTE_TERMINAL -#define yon_gtk_builder_get_widget(obj,obj2) GTK_WIDGET(gtk_builder_get_object(obj,obj2)) +/** + * +*/ +void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument); +#endif +/**yon_gtk_builder_get_widget(builder, widget_name) + * [EN] + * Returns GtkWidget from GtkBuilder *[builder]. + * [builder] is GtkBuilder*; + * [widget_name] is id of widget; +*/ +#define yon_gtk_builder_get_widget(builder, widget_name) GTK_WIDGET(gtk_builder_get_object(builder, widget_name)) -typedef struct { +typedef struct +{ GtkWidget *Icon; GtkWidget *Label; GtkWidget *IconView; GtkListStore *List; } expander_icon_view; - // GtkWidget *yon_gtk_app_chooser_apps_create(); // dictionary *yon_gtk_app_chooser_create(); // expander_icon_view yon_gtk_icon_view_expander_create(GtkWidget *pack, ...); -GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data); +int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); + +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); -//uninitialised - -void yon_on_plug_added(GtkSocket* self, gpointer user_data); -void yon_on_plug_removed(GtkSocket* self, gpointer user_data); -#endif -typedef enum { +typedef enum +{ BACKGROUND_IMAGE_SUCCESS_TYPE, BACKGROUND_IMAGE_FAIL_TYPE } BACKGROUND_IMAGE_TYPE; + +typedef struct { + BACKGROUND_IMAGE_TYPE type; + GtkWidget *icon; + GtkWidget *box; + GtkWidget *label; + char* text_to_render; +} render_data; + +/**yon_ubl_status_box_setup(render,icon,box,label) + * [EN] + * Sets up [render] structure of type render_data. + * [icon] is GtkImage widget of status box for showing status icons; + * [box] is GtkBox widget of status box for showing status color; + * [label] is GtkLabel widget of status box for showing status text; + * [RU] + * Настраивает структуру [render] типа render_data. + * [icon] - виджет типа GtkIcon в котором будут отображаться статусные иконки; + * [box] - виджет типа GtkBox в котором будет отображаться цвет статуса; + * [label] - виджет типа GtkLabel в котором будет отображаться текст статусного сообщения; +*/ +#define yon_ubl_status_box_setup(render,icon,box,label) {render.icon=GTK_WIDGET(icon); render.box=GTK_WIDGET(box); render.label=GTK_WIDGET(label);} + +/**yon_ubl_status_box_render(render,text,type) + * [EN] + * Renders message in status box; + * [render] is render_data structure of status box; + * [text] is text to be shown in status box; + * [type] if type of message. Can be BACKGROUND_IMAGE_FAIL_TYPE or BACKGROUND_IMAGE_SUCCESS_TYPE + * [RU] + * Отображает сообщение в статусном окне. + * [render] - структура типа render_data для нужного статусного окна; + * [text] - текст, отображаемый в статусном окне; + * [type] - тип сообщения. Может быть: + * BACKGROUND_IMAGE_FAIL_TYPE (красный фон,иконка - восклицательный знак) + * или + * BACKGROUND_IMAGE_SUCCESS_TYPE (Жёлтный фон, иконка - галка) +*/ +#define yon_ubl_status_box_render(render,text,m_type) {render.text_to_render=text; render.type=m_type; pthread_attr_t attr; pthread_attr_init(&attr); pthread_t tid; pthread_create(&tid,&attr,(void*)_yon_ubl_status_box_render,((void*)&render)); } + #ifdef __cplusplus -#define yon_ubl_header_setup(overlay,head,image,imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()),GTK_WIDGET(head.gobj()),GTK_WIDGET(image.gobj()),(char*)imag_path) -#define yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(GTK_WIDGET(statusbox.gobj()), GTK_WIDGET(statusicon.gobj()), GTK_WIDGET(statuslabel.gobj()), (char*)iconname, (char*)statustext, backgroundclass) + +/**yon_ubl_header_setup(overlay, head, image, imag_path) + * [EN] + * Sets up header of app. + * [overlay] is overlay for app header; + * [head] is box of header, which connects to [overlay] + * [image] is header background image; + * [imag_path] is path of image, shown in [image] + * [RU] + * Настраивает заголовок приложения. + * [overlay] - оверлей заголовка приложения; + * [head] - шапка заголовка, присоединяемая к [overlay] + * [image] - виджет картинки для заднего фона; + * [imag_path] - путь до картинки, загружаемой в [image] +*/ +#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()), GTK_WIDGET(head.gobj()), GTK_WIDGET(image.gobj()), (char *)imag_path) #else -#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_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) _yon_ubl_status_box_render(statusbox, statusicon, statuslabel, iconname, statustext, backgroundclass) + +/**yon_ubl_header_setup(overlay, head, image, imag_path) + * [EN] + * Sets up header of app. + * [overlay] is overlay for app header; + * [head] is box of header, which connects to [overlay] + * [image] is header background image; + * [imag_path] is path of image, shown in [image] + * [RU] + * Настраивает заголовок приложения. + * [overlay] - оверлей заголовка приложения; + * [head] - шапка заголовка, присоединяемая к [overlay] + * [image] - виджет картинки для заднего фона; + * [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) #endif void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path); -void _yon_ubl_status_box_render(GtkWidget *StatusBox, GtkWidget *StatusIcon, GtkWidget *StatusLabel, char *IconName, char* StatusText, BACKGROUND_IMAGE_TYPE BackgroundClass); +void _yon_ubl_status_box_render(render_data *datav); +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 + +void yon_ubl_browser_window_open(char *link, char *browser_window_name); +#else +void yon_ubl_browser_window_open(char *link, char *browser_window_name); +#endif +#endif #endif \ No newline at end of file diff --git a/ubl-settings-update.css b/ubl-settings-update.css index 515d75a..8687d4a 100644 --- a/ubl-settings-update.css +++ b/ubl-settings-update.css @@ -12,3 +12,97 @@ background:transparent; .nobackground:active { background:transparent; } +.textHead{ + text-shadow: 2px 2px @theme_bg_color; + color: @theme_text_color; +} + +.inherited>* { + border:none; + background:inherit; +} +.workingbg { + background:@theme_base_color; +} +.menuitembottom{ + margin-top:0px; + margin-bottom:3px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle{ + margin-top:0px; + margin-bottom:0px; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + + .menuitemtop{ + margin-bottom:0px; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemtop *{ + margin:2px 2px 0 2px; + padding: 5px 10px 3px 5px; + border:transparent; + } + .menuitemmiddle *{ + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + border:transparent; + } + .menuitembottom *{ + margin:0 2px 2px 2px; + padding: 3px 10px 5px 5px; + } + .menuitemtop:hover { + background:@theme_bg_color; + border-color:inherit; + border-top-width:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitemmiddle:hover { + background:@theme_bg_color; + border-color:inherit; + border-left-width:inherit; + border-right-width:inherit; + } + .menuitembottom:hover { + background:@theme_bg_color; + border-color:inherit; + border-bottom-width:0px; + border-left-width:inherit; + border-right-width:inherit; + + } + .menuitemtop:hover* { + margin:2px 2px 0 2px; + padding: 5px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitemmiddle:hover* { + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .menuitembottom:hover* { + margin:0 2px 2px 2px; + padding: 3px 10px 5px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + } + .boxInfoMessError{ + background-color: #ea9999; +} + +.boxInfoMessOK{ + background-color: #f3f0ac; +} \ No newline at end of file diff --git a/ubl-settings-update.desktop b/ubl-settings-update.desktop index c67c7c4..8428d00 100644 --- a/ubl-settings-update.desktop +++ b/ubl-settings-update.desktop @@ -1,9 +1,9 @@ [Desktop Entry] Encoding=UTF-8 Name=ubl-settings-update -Name[ru]=Настройки обновлений -GenericName=ubl-settings-quotas -GenericName[ru]=Настройки обновлений +Name[ru]=Обновление системы +GenericName=ubl-settings-update +GenericName[ru]=Обновление системы Comment=ubl-settings-update Comment[ru]=Приложение для управления настройками обновлений Type=Application diff --git a/ubl-settings-update.glade b/ubl-settings-update.glade index 2cfba93..5ebde48 100644 --- a/ubl-settings-update.glade +++ b/ubl-settings-update.glade @@ -1,8 +1,30 @@ - - + + + + + False False @@ -11,11 +33,11 @@ com.ublinux.ubl-settings-update dialog True - Update + ubl-settings-update 1.1 Copyright © 2022 - 2023, UBSoft LLC Update confugurator - https://ublinux.ru/ + https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-update Project Home Page Это приложение распространяется без каких-либо гарантий. Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. @@ -66,6 +88,7 @@ + True False @@ -107,7 +130,9 @@ 255 True False + end System update parameter configuration + 0 @@ -122,6 +147,28 @@ 0 + + + 255 + True + False + start + hsrdtfhbfn + 0 + + + + + + + + True + True + 1 + + False @@ -157,6 +204,7 @@ False System update + False True com.ublinux.ubl-settings-update @@ -175,10 +223,10 @@ False 5 - + True False - Type: + Adress: 0 @@ -188,7 +236,7 @@ - + True True @@ -211,43 +259,6 @@ False vertical 5 - - - True - False - 5 - - - True - False - URI: - 0 - - - False - True - 0 - - - - - True - False - 0 - - - False - True - 1 - - - - - False - True - 0 - - True @@ -267,13 +278,12 @@ - + True - False - 0 + True - False + True True 1 @@ -285,43 +295,6 @@ 1 - - - True - False - 5 - - - True - False - Sections: - 0 - - - False - True - 0 - - - - - True - False - 0 - - - False - True - 1 - - - - - False - True - 2 - - False @@ -397,12 +370,10 @@ - + - + - - @@ -425,82 +396,235 @@ start image4 - - - - - - - + + True + False + value-increase-symbolic - + True False - - - True - False - Load from global configuration - - - - - True - False - Load from local configuration - - + error-correct-symbolic - + True False - False - False - - - True - False - Documentation - True - - - - - True - False - About - - - + user-trash-symbolic - + True False + process-stop-symbolic + + + True + False + emblem-ok-symbolic + + + False + False + 450 + dialog-question-symbolic - - True - False - Save to global and local documentation - - - - + True False - Save to global configuration + 5 + 5 + 5 + 5 + vertical + 10 + + + True + False + + + True + False + start + 20 + 20 + dialog-question-symbolic + 6 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + start + 10 + 5 + Would you like to read documentation in the Web? + True + 0 + + + + + + + False + True + 0 + + + + + True + False + start + start + 10 + 10 + You will be redirected to documentation website where documentation is +translated and supported by community. + True + 0 + + + + False + True + 1 + + + + + Always redirect to online documentation + True + True + False + end + True + + + + False + True + end + 2 + + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + True + False + 30 + True + + + Cancel + True + True + True + image8 + + + + True + True + 0 + + + + + Read Online + True + True + True + image9 + + + + True + True + 1 + + + + + False + True + 1 + + - - + + True False - Save to local configuration + True + + + True + False + UBLinux Settings + + + + + + + + + + + + + + + + 800 + 600 False 800 600 @@ -515,6 +639,57 @@ True False vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 25 + + + False + True + 0 + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + + + + + + + False + True + 1 + + + + + False + True + 0 + + True @@ -530,7 +705,6 @@ True False start - gtk-missing-image -1 @@ -619,6 +793,7 @@ True False + 0 False @@ -714,6 +889,8 @@ True False + 5 + 5 5 @@ -728,9 +905,6 @@ Enabled - - 0 - @@ -740,7 +914,18 @@ - 0 + 1 + + + + + + + Distribution + + + + 2 @@ -756,9 +941,9 @@ True False - center + start vertical - 25 + 15 True @@ -788,30 +973,62 @@ False True - 0 + 0 + + + + + True + True + True + + + True + False + True + False + True + + + + + + + + + + False + True + 1 + + + + + True + True + True + image5 + + + + False + True + 2 - + True True True - - - True - False - True - False - True - - - - - - + image6 @@ -819,7 +1036,23 @@ False True - 1 + 3 + + + + + True + True + True + image7 + + + + False + True + 4 @@ -836,60 +1069,6 @@ 1 - - - True - False - 5 - 5 - 5 - - - Create - True - True - True - - - False - True - 0 - - - - - Edit - True - True - True - - - False - True - 1 - - - - - Delete - True - True - True - - - False - True - 2 - - - - - False - True - end - 2 - - 1 @@ -1051,7 +1230,6 @@ False True - end 3 @@ -1134,63 +1312,52 @@ - - True - True - True - False - True - True - menu2 - none - - - - - - - end - 1 - - - - + True - True - False - True - menu1 + False - + True - False - - - True - False - Load - - - False - True - 0 - - + True + False + True + menu1 - + True False - pan-down-symbolic + + + True + False + Load + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + - - False - True - 1 - + + False + True + 0 + @@ -1198,41 +1365,75 @@ - + True - True - False - True - menu3 + False - + True - False + True + False + True + menu3 - + True False - Save + + + True + False + Save + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + - - False - True - 0 - + + + False + True + 0 + + + + + True + True + True + False + True + True + menu2 + none - - True - False - pan-down-symbolic - - - False - True - 1 - + + + + False + True + 1 + @@ -1253,4 +1454,92 @@ + + True + False + False + + + True + False + Load from global configuration + + + + + + True + False + Load from local configuration + + + + + + True + False + False + False + + + True + False + Documentation + True + + + + + + True + False + About + + + + + + True + False + False + + + True + False + Save to global and local documentation + + + + + + True + False + Save to global configuration + + + + + + True + False + Save to local configuration + + + + diff --git a/ubl-settings-update.pot b/ubl-settings-update.pot index 7ee8f2e..d5ca432 100644 --- a/ubl-settings-update.pot +++ b/ubl-settings-update.pot @@ -1,184 +1,249 @@ -# language translations for ubl-settings-manager package. +# Language translations for ubl-settings-update package. # Copyright (C) 2022, UBTech LLC -# This file is distributed under the same license as the ubl-settings-manager package. +# This file is distributed under the same license as the ubl-settings-update package. # UBLinux Team , 2022 # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: ubl-settings-manager 1.0\n" -"Report-Msgid-Bugs-To: info@ublinux.com\n" -"POT-Creation-Date: 2023-04-21 12:33+0000\n" -"PO-Revision-Date: 2023-01-01 00:00+0600\n" -"Last-Translator: UBLinux Team \n" -"Language-Team: Russian - UBLinux Team \n" -"Language: Russian\n" +"Project-Id-Version: ubl-settings-update 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-05-22 17:22+0600\n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: source/ubl-settings-update.c:16 -msgid "UBlinux System update" +#: source/ubl-settings-update-strings.h:1 +msgid "Version:" msgstr "" -#: source/ubl-settings-update.c:18 -msgid "Project Home Page" +#: source/ubl-settings-update-strings.h:2 +msgid "ubl-settings-update version:" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "update settings" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "Usage:" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "[OPTIONS]" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "Options:" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "Show this help" msgstr "" -#: source/ubl-settings-update.c:19 -msgid "Update configurator" +#: source/ubl-settings-update-strings.h:2 +msgid "Show package version" msgstr "" -#: source/ubl-settings-update.c:46 source/ubl-settings-update.c:111 -#: source/ubl-settings-update.c:113 +#: source/ubl-settings-update-strings.h:2 +msgid "Lock this help menu" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock configuration saving" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock local configration saving" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock global configration saving" +msgstr "" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock global configration loading" +msgstr "" + +#: source/ubl-settings-update-strings.h:3 msgid "System update" msgstr "" -#: source/ubl-settings-update.c:48 -msgid "Type: " +#: source/ubl-settings-update-strings.h:4 +msgid "System update settings management" +msgstr "" + +#: source/ubl-settings-update-strings.h:5 +msgid "Check for updates" msgstr "" -#: source/ubl-settings-update.c:49 -msgid "URI: " +#: source/ubl-settings-update-strings.h:6 +msgid "About" msgstr "" -#: source/ubl-settings-update.c:50 source/ubl-settings-update.c:52 -#: source/ubl-settings-update.c:54 -msgid " " +#: source/ubl-settings-update-strings.h:7 +msgid "Documentation" msgstr "" -#: source/ubl-settings-update.c:51 -msgid "Distribution: " +#: source/ubl-settings-update-strings.h:8 +msgid "Save to local configuration" msgstr "" -#: source/ubl-settings-update.c:53 -msgid "Sections: " +#: source/ubl-settings-update-strings.h:9 +msgid "Save to global configuration" msgstr "" -#: source/ubl-settings-update.c:56 -msgid "Cancel" +#: source/ubl-settings-update-strings.h:10 +msgid "Save configuration" msgstr "" -#: source/ubl-settings-update.c:57 source/ubl-settings-update.c:143 +#: source/ubl-settings-update-strings.h:11 +#: source/ubl-settings-update-strings.h:36 msgid "Save" msgstr "" -#: source/ubl-settings-update.c:115 -msgid "General" +#: source/ubl-settings-update-strings.h:12 +msgid "Load local configuration" msgstr "" -#: source/ubl-settings-update.c:116 -msgid "Repositories" +#: source/ubl-settings-update-strings.h:13 +msgid "Load global configuration" msgstr "" -#: source/ubl-settings-update.c:117 -msgid "Extra" +#: source/ubl-settings-update-strings.h:14 +msgid "load" msgstr "" -#: source/ubl-settings-update.c:119 -msgid "Update checking frequency" +#: source/ubl-settings-update-strings.h:15 +msgid "Launch package manager" msgstr "" -#: source/ubl-settings-update.c:120 -msgid "Hide icon of no updates found" +#: source/ubl-settings-update-strings.h:16 +msgid "Cache clean command: " msgstr "" -#: source/ubl-settings-update.c:121 -msgid "Download updates automatically" +#: source/ubl-settings-update-strings.h:17 +msgid "Update command: " msgstr "" -#: source/ubl-settings-update.c:122 -msgid "Every 1 hour" +#: source/ubl-settings-update-strings.h:18 +msgid "Package manager: " msgstr "" -#: source/ubl-settings-update.c:123 -msgid "Every 2 hours" +#: source/ubl-settings-update-strings.h:19 +msgid "URI" msgstr "" -#: source/ubl-settings-update.c:124 -msgid "Every 3 hours" +#: source/ubl-settings-update-strings.h:20 +msgid "Enabled" msgstr "" -#: source/ubl-settings-update.c:126 -msgid "Activate AUR" +#: source/ubl-settings-update-strings.h:21 +msgid "Distribution" msgstr "" -#: source/ubl-settings-update.c:127 +#: source/ubl-settings-update-strings.h:22 msgid "Activate UBUR" msgstr "" -#: source/ubl-settings-update.c:128 -msgid "Create" +#: source/ubl-settings-update-strings.h:23 +msgid "Activate AUR" msgstr "" -#: source/ubl-settings-update.c:129 -msgid "Edit" +#: source/ubl-settings-update-strings.h:24 +msgid "Every 3 hours" msgstr "" -#: source/ubl-settings-update.c:130 -msgid "Delete" +#: source/ubl-settings-update-strings.h:25 +msgid "Every 2 hours" msgstr "" -#: source/ubl-settings-update.c:131 -msgid "Enabled" +#: source/ubl-settings-update-strings.h:26 +msgid "Every 1 hour" msgstr "" -#: source/ubl-settings-update.c:132 -msgid "URI" +#: source/ubl-settings-update-strings.h:27 +msgid "Download updates automatically" msgstr "" -#: source/ubl-settings-update.c:134 -msgid "Package manager: " +#: source/ubl-settings-update-strings.h:28 +msgid "Hide icon of no updates found" msgstr "" -#: source/ubl-settings-update.c:135 -msgid "Update command: " +#: source/ubl-settings-update-strings.h:29 +msgid "Update checking frequency" msgstr "" -#: source/ubl-settings-update.c:136 -msgid "Cache clean command: " +#: source/ubl-settings-update-strings.h:30 +msgid "Extra" msgstr "" -#: source/ubl-settings-update.c:137 -msgid "Launch package manager" +#: source/ubl-settings-update-strings.h:31 +msgid "Repositories" msgstr "" -#: source/ubl-settings-update.c:139 -msgid "load" +#: source/ubl-settings-update-strings.h:32 +msgid "General" msgstr "" -#: source/ubl-settings-update.c:140 -msgid "Load global configuration" +#: source/ubl-settings-update-strings.h:33 +msgid "Adress: " msgstr "" -#: source/ubl-settings-update.c:141 -msgid "Load local configuration" +#: source/ubl-settings-update-strings.h:34 +msgid "Distribution: " msgstr "" -#: source/ubl-settings-update.c:144 -msgid "Save to global and local configuration" +#: source/ubl-settings-update-strings.h:35 +msgid "Cancel" msgstr "" -#: source/ubl-settings-update.c:145 -msgid "Save to global configuration" +#: source/ubl-settings-update-strings.h:37 +msgid "Would you like to read documentation in the Web?" msgstr "" -#: source/ubl-settings-update.c:146 -msgid "Save to local configuration" +#: source/ubl-settings-update-strings.h:38 +msgid "" +"You will be redirected to documentation website where documentation is\n" +"translated and supported by community." msgstr "" -#: source/ubl-settings-update.c:148 -msgid "Documentation" +#: source/ubl-settings-update-strings.h:39 +msgid "Always redirect to online documentation" msgstr "" -#: source/ubl-settings-update.c:149 -msgid "About" +#: source/ubl-settings-update-strings.h:40 +msgid "Open documentation" msgstr "" -#: source/ubl-settings-update.c:151 -msgid "Check for updates" +#: source/ubl-settings-update-strings.h:41 +msgid "Project Home Page" +msgstr "" + +#: source/ubl-settings-update-strings.h:42 +msgid "Nothing were chosen" +msgstr "" + +#: source/ubl-settings-update-strings.h:44 +msgid "Global configuration loading succseeded." +msgstr "" + +#: source/ubl-settings-update-strings.h:45 +msgid "Local configuration loading succseeded." +msgstr "" + +#: source/ubl-settings-update-strings.h:47 +msgid "Local and global configuration saving succseeded." +msgstr "" + +#: source/ubl-settings-update-strings.h:48 +msgid "Global configuration saving succseeded." msgstr "" -#: source/ubl-settings-update.c:166 -msgid "System update parameter configuration" +#: source/ubl-settings-update-strings.h:49 +msgid "Local configuration saving succseeded." msgstr "" diff --git a/ubl-settings-update_ru.po b/ubl-settings-update_ru.po index fe04db6..655c950 100644 --- a/ubl-settings-update_ru.po +++ b/ubl-settings-update_ru.po @@ -1,14 +1,14 @@ -# Russian translations for ubl-settings-manager package. +# Russian translations for ubl-settings-update package. # Copyright (C) 2022, UBTech LLC -# This file is distributed under the same license as the ubl-settings-manager package. +# This file is distributed under the same license as the ubl-settings-update package. # UBLinux Team , 2022 # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: ubl-settings-manager 1.0\n" -"Report-Msgid-Bugs-To: info@ublinux.com\n" -"POT-Creation-Date: 2023-04-21 12:33+0000\n" +"Project-Id-Version: ubl-settings-update 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-05-22 17:22+0600\n" "PO-Revision-Date: 2023-01-01 00:00+0600\n" "Last-Translator: UBLinux Team \n" "Language-Team: Russian - UBLinux Team \n" @@ -17,173 +17,236 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: source/ubl-settings-update.c:16 -#, fuzzy -msgid "UBlinux System update" -msgstr "Обновление системы" +#: source/ubl-settings-update-strings.h:1 +msgid "Version:" +msgstr "Версия:" -#: source/ubl-settings-update.c:18 -#, fuzzy -msgid "Project Home Page" -msgstr "Домашняя страница проекта" +#: source/ubl-settings-update-strings.h:2 +msgid "ubl-settings-update version:" +msgstr "Версия ubl-settings-update: " -#: source/ubl-settings-update.c:19 -#, fuzzy -msgid "Update configurator" -msgstr "Загрузить локальную конфигурацию" +#: source/ubl-settings-update-strings.h:2 +msgid "update settings" +msgstr "Настройки обновлений" + +#: source/ubl-settings-update-strings.h:2 +msgid "Usage:" +msgstr "Использование:" + +#: source/ubl-settings-update-strings.h:2 +msgid "[OPTIONS]" +msgstr "[АРГУМЕНТЫ]" + +#: source/ubl-settings-update-strings.h:2 +msgid "Options:" +msgstr "Аргументы:" + +#: source/ubl-settings-update-strings.h:2 +msgid "Show this help" +msgstr "Показать параметры справки" + +#: source/ubl-settings-update-strings.h:2 +msgid "Show package version" +msgstr "Показать текущую версию" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock this help menu" +msgstr "Блокировка вызова справки" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock configuration saving" +msgstr "Блокировка сохранения локальной и глобальной конфигурации" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock local configration saving" +msgstr "Блокировка сохранения локальной конфигурации" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock global configration saving" +msgstr "Блокировка сохранения глобальной конфигурации" + +#: source/ubl-settings-update-strings.h:2 +msgid "Lock global configration loading" +msgstr "Блокировка загрузки глобальной конфигурации" -#: source/ubl-settings-update.c:46 source/ubl-settings-update.c:111 -#: source/ubl-settings-update.c:113 +#: source/ubl-settings-update-strings.h:3 msgid "System update" msgstr "Обновление системы" -#: source/ubl-settings-update.c:48 -msgid "Type: " -msgstr "Тип: " +#: source/ubl-settings-update-strings.h:4 +msgid "System update settings management" +msgstr "Настройка параметров обновления системы" -#: source/ubl-settings-update.c:49 -msgid "URI: " -msgstr "URI: " +#: source/ubl-settings-update-strings.h:5 +msgid "Check for updates" +msgstr "Проверить обновления" -#: source/ubl-settings-update.c:50 source/ubl-settings-update.c:52 -#: source/ubl-settings-update.c:54 -msgid " " -msgstr " " +#: source/ubl-settings-update-strings.h:6 +msgid "About" +msgstr "О программе" -#: source/ubl-settings-update.c:51 -msgid "Distribution: " -msgstr "Дистрибутив: " +#: source/ubl-settings-update-strings.h:7 +msgid "Documentation" +msgstr "Справка" -#: source/ubl-settings-update.c:53 -msgid "Sections: " -msgstr "Разделы: " +#: source/ubl-settings-update-strings.h:8 +msgid "Save to local configuration" +msgstr "Сохранить в локальную конфигурацию" -#: source/ubl-settings-update.c:56 -msgid "Cancel" -msgstr "Отмена" +#: source/ubl-settings-update-strings.h:9 +msgid "Save to global configuration" +msgstr "Сохранить в глобальную конфигурацию" + +#: source/ubl-settings-update-strings.h:10 +msgid "Save configuration" +msgstr "Сохранить в конфигурацию" -#: source/ubl-settings-update.c:57 source/ubl-settings-update.c:143 +#: source/ubl-settings-update-strings.h:11 +#: source/ubl-settings-update-strings.h:36 msgid "Save" msgstr "Сохранить" -#: source/ubl-settings-update.c:115 -msgid "General" -msgstr "Общие настройки" +#: source/ubl-settings-update-strings.h:12 +msgid "Load local configuration" +msgstr "Загрузить локальную конфигурацию" -#: source/ubl-settings-update.c:116 -msgid "Repositories" -msgstr "Репозитории" +#: source/ubl-settings-update-strings.h:13 +msgid "Load global configuration" +msgstr "Загрузить глобальную конфигурацию" -#: source/ubl-settings-update.c:117 -msgid "Extra" -msgstr "Дополнительно" +#: source/ubl-settings-update-strings.h:14 +msgid "load" +msgstr "Загрузить" -#: source/ubl-settings-update.c:119 -msgid "Update checking frequency" -msgstr "Частота проверки обновлений" +#: source/ubl-settings-update-strings.h:15 +msgid "Launch package manager" +msgstr "Запустить менеджер пакетов" -#: source/ubl-settings-update.c:120 -msgid "Hide icon of no updates found" -msgstr "Скрыть значок в трее при отсутствии обновлений" +#: source/ubl-settings-update-strings.h:16 +msgid "Cache clean command: " +msgstr "Команда очистки кеша пакетов: " -#: source/ubl-settings-update.c:121 -msgid "Download updates automatically" -msgstr "Автоматически скачивать обновления" +#: source/ubl-settings-update-strings.h:17 +msgid "Update command: " +msgstr "Команда обновления: " -#: source/ubl-settings-update.c:122 -msgid "Every 1 hour" -msgstr "Каждый час" +#: source/ubl-settings-update-strings.h:18 +msgid "Package manager: " +msgstr "Менеджер пакетов: " -#: source/ubl-settings-update.c:123 -msgid "Every 2 hours" -msgstr "Каждые 2 часа" +#: source/ubl-settings-update-strings.h:19 +msgid "URI" +msgstr "URI" -#: source/ubl-settings-update.c:124 -msgid "Every 3 hours" -msgstr "Каждые 3 часа" +#: source/ubl-settings-update-strings.h:20 +msgid "Enabled" +msgstr "Включен" -#: source/ubl-settings-update.c:126 -msgid "Activate AUR" -msgstr "Активировать AUR" +#: source/ubl-settings-update-strings.h:21 +msgid "Distribution" +msgstr "Дистрибутив" -#: source/ubl-settings-update.c:127 +#: source/ubl-settings-update-strings.h:22 msgid "Activate UBUR" msgstr "Активировать UBUR" -#: source/ubl-settings-update.c:128 -msgid "Create" -msgstr "Создать" +#: source/ubl-settings-update-strings.h:23 +msgid "Activate AUR" +msgstr "Активировать AUR" -#: source/ubl-settings-update.c:129 -msgid "Edit" -msgstr "Изменить" +#: source/ubl-settings-update-strings.h:24 +msgid "Every 3 hours" +msgstr "Каждые 3 часа" -#: source/ubl-settings-update.c:130 -msgid "Delete" -msgstr "Удалить" +#: source/ubl-settings-update-strings.h:25 +msgid "Every 2 hours" +msgstr "Каждые 2 часа" -#: source/ubl-settings-update.c:131 -msgid "Enabled" -msgstr "Включен" +#: source/ubl-settings-update-strings.h:26 +msgid "Every 1 hour" +msgstr "Каждый час" -#: source/ubl-settings-update.c:132 -#, fuzzy -msgid "URI" -msgstr "URI" +#: source/ubl-settings-update-strings.h:27 +msgid "Download updates automatically" +msgstr "Автоматически скачивать обновления" -#: source/ubl-settings-update.c:134 -msgid "Package manager: " -msgstr "Менеджер пакетов: " +#: source/ubl-settings-update-strings.h:28 +msgid "Hide icon of no updates found" +msgstr "Скрыть значок в трее при отсутствии обновлений" -#: source/ubl-settings-update.c:135 -msgid "Update command: " -msgstr "Команда обновления: " +#: source/ubl-settings-update-strings.h:29 +msgid "Update checking frequency" +msgstr "Частота проверки обновлений" -#: source/ubl-settings-update.c:136 -msgid "Cache clean command: " -msgstr "Команда очистки кеша пакетов: " +#: source/ubl-settings-update-strings.h:30 +msgid "Extra" +msgstr "Дополнительно" -#: source/ubl-settings-update.c:137 -msgid "Launch package manager" -msgstr "Запустить менеджер пакетов" +#: source/ubl-settings-update-strings.h:31 +msgid "Repositories" +msgstr "Репозитории" -#: source/ubl-settings-update.c:139 -msgid "load" -msgstr "Загрузить" +#: source/ubl-settings-update-strings.h:32 +msgid "General" +msgstr "Общие настройки" -#: source/ubl-settings-update.c:140 -msgid "Load global configuration" -msgstr "Загрузить глобальную конфигурацию" +#: source/ubl-settings-update-strings.h:33 +msgid "Adress: " +msgstr "Адрес: " -#: source/ubl-settings-update.c:141 -msgid "Load local configuration" -msgstr "Загрузить локальную конфигурацию" +#: source/ubl-settings-update-strings.h:34 +msgid "Distribution: " +msgstr "Дистрибутив: " -#: source/ubl-settings-update.c:144 -msgid "Save to global and local configuration" -msgstr "Сохранить в глобальную и локальную конфигурацию" +#: source/ubl-settings-update-strings.h:35 +msgid "Cancel" +msgstr "Отмена" -#: source/ubl-settings-update.c:145 -msgid "Save to global configuration" -msgstr "Сохранить в глобальную конфигурацию" +#: source/ubl-settings-update-strings.h:37 +msgid "Would you like to read documentation in the Web?" +msgstr "Вы хотите прочитать справку в Сети?" -#: source/ubl-settings-update.c:146 -msgid "Save to local configuration" -msgstr "Сохранить в локальную конфигурацию" +#: source/ubl-settings-update-strings.h:38 +msgid "" +"You will be redirected to documentation website where documentation is\n" +"translated and supported by community." +msgstr "" +"Вы будете перенаправлены на сайт с документацией где страницы помощи\n" +"переводятся и поддерживаются сообществом." -#: source/ubl-settings-update.c:148 -msgid "Documentation" +#: source/ubl-settings-update-strings.h:39 +msgid "Always redirect to online documentation" +msgstr "Всегда перенаправлять" + +#: source/ubl-settings-update-strings.h:40 +msgid "Open documentation" msgstr "Справка" -#: source/ubl-settings-update.c:149 -msgid "About" -msgstr "О программе" +#: source/ubl-settings-update-strings.h:41 +msgid "Project Home Page" +msgstr "Домашняя страница проекта" -#: source/ubl-settings-update.c:151 -msgid "Check for updates" -msgstr "Проверить обновления" +#: source/ubl-settings-update-strings.h:42 +msgid "Nothing were chosen" +msgstr "Ничего не выбрано" + +#: source/ubl-settings-update-strings.h:44 +msgid "Global configuration loading succseeded." +msgstr "Успешно загружена глобальная конфигурация" + +#: source/ubl-settings-update-strings.h:45 +msgid "Local configuration loading succseeded." +msgstr "Успешно загружена локальная конфигурация" + +#: source/ubl-settings-update-strings.h:47 +msgid "Local and global configuration saving succseeded." +msgstr "Успешно записаны локальная и глобальная конфигурация" + +#: source/ubl-settings-update-strings.h:48 +msgid "Global configuration saving succseeded." +msgstr "Успешно записана глобальная конфигурация" + +#: source/ubl-settings-update-strings.h:49 +msgid "Local configuration saving succseeded." +msgstr "Успешно записана локальная конфигурация" -#: source/ubl-settings-update.c:166 -#, fuzzy -msgid "System update parameter configuration" -msgstr "настройка параметров обновления системы"