|
|
#include <gtk/gtk.h>
|
|
|
#include <gtk/gtkx.h>
|
|
|
#include <locale.h>
|
|
|
#include <stdio.h>
|
|
|
#include <unistd.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <libintl.h>
|
|
|
#include <getopt.h>
|
|
|
#include <libintl.h>
|
|
|
#include <sys/types.h>
|
|
|
#include <fcntl.h>
|
|
|
#include <libublsettings.h>
|
|
|
#include <libublsettings-gtk3.h>
|
|
|
#include <libublsettingsui-gtk3.h>
|
|
|
#ifdef WEBKIT_FOUND
|
|
|
#include <webkit2/webkit2.h>
|
|
|
#endif
|
|
|
#include "ubl-strings.h"
|
|
|
|
|
|
#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-repomanager"
|
|
|
|
|
|
#define _(String) gettext(String)
|
|
|
|
|
|
#define glade_path "/com/ublinux/ui/ubl-settings-repomanager.glade"
|
|
|
#define glade_path_repo_add "/com/ublinux/ui/ubl-settings-repomanager-add.glade"
|
|
|
#define glade_path_storage_config "/com/ublinux/ui/ubl-settings-repomanager-configuration.glade"
|
|
|
#define glade_path_repo_block "/com/ublinux/ui/ubl-settings-repomanager-repo-block.glade"
|
|
|
#define glade_path_filechooser "/com/ublinux/ui/ubl-settings-repomanager-filechooser.glade"
|
|
|
#define glade_path_key "/com/ublinux/ui/ubl-settings-repomanager-key.glade"
|
|
|
#define banner_path "/com/ublinux/images/ubl-settings-repomanager-banner.png"
|
|
|
#define CssPath "/com/ublinux/css/ubl-settings-repomanager.css"
|
|
|
#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
|
|
|
#define icon_path "com.ublinux.ubl-settings-repomanager"
|
|
|
|
|
|
#define folder_no_edits "com.ublinux.libublsettingsui-gtk3.folder-symbolic"
|
|
|
#define document_no_edits "com.ublinux.libublsettingsui-gtk3.key-symbolic"
|
|
|
#define document_deleted "com.ublinux.ubl-settings-repomanager.key-red-symbolic"
|
|
|
#define document_added "com.ublinux.ubl-settings-repomanager.key-green-symbolic"
|
|
|
|
|
|
#define LocalePath "/usr/share/locale"
|
|
|
#define LocaleName "ubl-settings-repomanager"
|
|
|
|
|
|
#define key_icon_name "com.ublinux.libublsettingsui-gtk3.key-symbolic"
|
|
|
|
|
|
#define key_encription_path "/usr/share/ubl-settings-repomanager/csv/crypt-key.csv"
|
|
|
typedef char* string;
|
|
|
|
|
|
#define get_saved_package_info_command(path,filename) yon_char_unite("LC_ALL=EN pacman -Q --info --file $(find \"",path,"\" -name \"*",filename,"*\" -not -name *.sig |head -n 1)|sed -e 's/ */ /g' -e 's/ : /:/g' -e 's/\\n/ /g'",NULL)
|
|
|
|
|
|
#define get_gpg_keys_command yon_char_unite(yon_ubl_check_root()==1 ? yon_char_unite("su - ",yon_ubl_root_user_get()," -c \"gpg --list-signatures\"",NULL):"gpg --list-signatures"," | grep '^sig 3' | cut -d' ' -f10,11,13- | sort -u |sed -e 's/[0-9]*-[0-9]*-[0-9]* //g'",NULL)
|
|
|
|
|
|
#define create_storage_command(path,name) yon_char_unite("repo-manager add -r '",name,"' -d '", path,"'",NULL)
|
|
|
#define add_packages_command(path,arch,name,packages_path) yon_char_unite("repo-manager add -r '",name,"' -a '",arch,"' -d '", path,"' ",packages_path,NULL)
|
|
|
#define add_packages_sign_command(path,arch,name,repo_sign,pack_sign,packages_path) yon_char_unite("repo-manager add -r '",name,"' -a '",arch,"' -d '", path,"' -S '",repo_sign,"' -s '",pack_sign,"' ",packages_path,NULL)
|
|
|
#define add_packages_package_sign_command(path,arch,name,sign,packages_path) yon_char_unite("repo-manager add -r '",name,"' -a '",arch,"' -d '", path,"' -S '",sign,"' ",packages_path,NULL)
|
|
|
#define add_packages_repo_sign_command(path,arch,name,sign,packages_path) yon_char_unite("repo-manager add -r '",name,"' -a '",arch,"' -d '", path,"' -S '",sign,"' ",packages_path,NULL)
|
|
|
#define remove_packages_command(path,arch,name,packages_path) yon_char_unite("repo-manager remove -r '",name,"' -a '",arch,"' -d '", path,"' ",packages_path,NULL)
|
|
|
|
|
|
#define yon_move_packages_command(storage,arch, source_repo, target_repo, packages) yon_char_unite("repo-manager move -d '",storage,"' -a '",arch,"' -R '",source_repo,"' -r '",target_repo,"' ", packages,NULL)
|
|
|
#define yon_delete_packages_command(storage,arch, target_repo, packages) yon_char_unite("repo-manager remove -d '",storage,"' -a '",arch,"' -r '",target_repo,"' ", packages,NULL)
|
|
|
#define yon_delete_packages_sign_command(storage,arch, target_repo,sign, packages) yon_char_unite("repo-manager remove -d '",storage,"' -a '",arch,"' -r '",target_repo,"' --S '",sign,"' ", packages,NULL)
|
|
|
|
|
|
#define yon_get_package_name_from_filename(path) yon_char_unite("[[ '",path,"' =~ (.*/)*(.*)-[^-]+-[^-]+-[^-]+\\.pkg\\.tar\\.[^.-]+ ]] && echo ${BASH_REMATCH[2]}",NULL)
|
|
|
|
|
|
#define yon_get_filename_from_package_name(target) yon_char_unite("find ${PATH} -maxdepth 1 -regextype egrep -regex \".*/",target,"-[^-]+-[^-]+-[^-]+\\.pkg\\.tar\\.[^-.]*\"",NULL)
|
|
|
|
|
|
#define get_gpg_keys_command yon_char_unite(yon_ubl_check_root()==1 ? yon_char_unite("su - ",yon_ubl_root_user_get()," -c \"gpg --list-signatures\"",NULL):"gpg --list-signatures"," | grep '^sig 3' | cut -d' ' -f10,11,13- | sort -u |sed -e 's/[0-9]*-[0-9]*-[0-9]* //g'",NULL)
|
|
|
|
|
|
#define yon_sign_package(storage,repo,arch,target,sign) yon_char_unite("repo-manager add -r '",repo,"' -a '",arch,"' -d '", storage,"' -S '",sign,"' ",target,NULL)
|
|
|
#define yon_sign_repo(storage,repo,sign) yon_char_unite("repo-manager add -f -r '",repo,"' -d '", storage,"' --sign-repo='",sign,"'",NULL)
|
|
|
|
|
|
#define get_package_info_command(filename) yon_char_unite("pacman -Q --info --file ",filename," |sed -e 's/ */ /g' -e 's/ : /:/g' -e 's/\\n/ /g' -e 's/^ /\\t/g'",NULL)
|
|
|
|
|
|
#define yon_generate_key_command(type,name,email,strength,comment,expire,password) yon_char_unite("gpg --batch --gen-key <<EOF\n\
|
|
|
%echo Generating a basic OpenPGP key\n\
|
|
|
Key-Type: ",type,"\n\
|
|
|
Key-Length: 1024\n\
|
|
|
Subkey-Type: ELG-E\n\
|
|
|
Subkey-Length: ",strength,"\n\
|
|
|
Name-Real: ",name,"\n\
|
|
|
Name-Comment: ",comment,"\n\
|
|
|
Name-Email: ",email,"\n\
|
|
|
Expire-Date: ",expire,"\n\
|
|
|
Passphrase: ",password,"\n\
|
|
|
%commit\n\
|
|
|
%echo done\n\
|
|
|
EOF",NULL)
|
|
|
|
|
|
#define yon_generate_key_no_password_command(type,name,email,strength,comment,expire,password) yon_char_unite("gpg --batch --gen-key <<EOF\n\
|
|
|
%echo Generating a basic OpenPGP key\n\
|
|
|
Key-Type: ",type,"\n\
|
|
|
Key-Length: 1024\n\
|
|
|
Subkey-Type: ELG-E\n\
|
|
|
Subkey-Length: ",strength,"\n\
|
|
|
Name-Real: ",name,"\n\
|
|
|
Name-Comment: ",comment,"\n\
|
|
|
Name-Email: ",email,"\n\
|
|
|
Expire-Date: ",expire,"\n\
|
|
|
%no-protection\n\
|
|
|
%commit\n\
|
|
|
%echo done\n\
|
|
|
EOF",NULL)
|
|
|
|
|
|
string version_application;
|
|
|
|
|
|
char *local;
|
|
|
|
|
|
typedef struct {
|
|
|
template_config_fields
|
|
|
GtkTreeStore *tree_store;
|
|
|
int lock_root;
|
|
|
config_str signs;
|
|
|
int signs_size;
|
|
|
} config;
|
|
|
|
|
|
typedef struct {
|
|
|
template_window_fields
|
|
|
GtkWidget *UpdateButton;
|
|
|
GtkWidget *DBConfigurationButton;
|
|
|
GtkWidget *AddButton;
|
|
|
GtkWidget *MoveButton;
|
|
|
GtkWidget *RemoveButton;
|
|
|
GtkWidget *CloudButton;
|
|
|
GtkWidget *ReposTree;
|
|
|
GtkWidget *RepoFileTree;
|
|
|
GtkWidget *SearchEntry;
|
|
|
GtkWidget *RepoPackagesTree;
|
|
|
GtkWidget *InformationLabel;
|
|
|
GtkWidget *KeyMenuItem;
|
|
|
GtkTreeStore *RepoList;
|
|
|
GtkListStore *RepoFileList;
|
|
|
GtkListStore *RepoPackagesTre;
|
|
|
} main_window;
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *MainWindow;
|
|
|
GtkWidget *StatusBox;
|
|
|
GtkWidget *HeadLabel;
|
|
|
GtkWidget *CancelButton;
|
|
|
GtkWidget *AddButton;
|
|
|
GtkWidget *MoveSourceFrame;
|
|
|
GtkWidget *MoveSourceStorageEntry;
|
|
|
GtkWidget *MoveSourceRepoEntry;
|
|
|
GtkWidget *MoveSourceArchEntry;
|
|
|
GtkWidget *MoveTargetFrame;
|
|
|
GtkWidget *MoveTargetStorageEntry;
|
|
|
GtkWidget *MoveTargetRepoEntry;
|
|
|
GtkWidget *MoveTargetArchEntry;
|
|
|
GtkWidget *StorageCombo;
|
|
|
GtkWidget *RepositoryCombo;
|
|
|
GtkWidget *ArchitectureCombo;
|
|
|
GtkWidget *PackageSignCombo;
|
|
|
GtkWidget *RepoSignCombo;
|
|
|
GtkWidget *AddPackageButton;
|
|
|
GtkWidget *RemoveButton;
|
|
|
GtkWidget *PackagesTree;
|
|
|
GtkWidget *InfoLabel;
|
|
|
GtkWidget *TestTree;
|
|
|
GtkListStore *PackagesList;
|
|
|
GtkTreeStore *tree_copy;
|
|
|
GtkTreeModel *storage_filter;
|
|
|
GtkTreeModel *repo_filter;
|
|
|
GtkTreeModel *arch_filter;
|
|
|
GtkTreeModel *package_filter;
|
|
|
|
|
|
dictionary *added_packages_archs;
|
|
|
dictionary *removed_packages_archs;
|
|
|
} repo_add_window;
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *MainWindow;
|
|
|
GtkWidget *HeadLabel;
|
|
|
GtkWidget *CancelButton;
|
|
|
GtkWidget *AcceptButton;
|
|
|
GtkWidget *StatusBox;
|
|
|
GtkWidget *StoragePathCombo;
|
|
|
GtkWidget *OpenExistingButton;
|
|
|
GtkWidget *CreateNewButton;
|
|
|
GtkWidget *DisableButton;
|
|
|
GtkWidget *DeleteButton;
|
|
|
GtkWidget *ReposBox;
|
|
|
GtkWidget *AddEntry;
|
|
|
GtkWidget *AddRepoButton;
|
|
|
GtkWidget *TestTree;
|
|
|
GtkListStore *StorageList;
|
|
|
GtkTreeStore *storages_copy;
|
|
|
GtkTreeModel *StorageFilter;
|
|
|
} storage_config_window;
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *Window;
|
|
|
GtkWidget *StatusBox;
|
|
|
GtkWidget *HeadLabel;
|
|
|
GtkWidget *CancelButton;
|
|
|
GtkWidget *ChooseButton;
|
|
|
GtkWidget *NameEntry;
|
|
|
GtkWidget *FileChooserWidget;
|
|
|
char *root_path;
|
|
|
} file_chooser_window;
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *Window;
|
|
|
GtkWidget *StatusBox;
|
|
|
GtkWidget *HeadLabel;
|
|
|
GtkWidget *NameEntry;
|
|
|
GtkWidget *EmailEntry;
|
|
|
GtkWidget *CommentsEntry;
|
|
|
GtkWidget *EncryptionCombo;
|
|
|
GtkWidget *KeyStrengthSpin;
|
|
|
GtkWidget *ExpireCombo;
|
|
|
GtkWidget *ExpireEntry;
|
|
|
GtkWidget *ExpireButton;
|
|
|
GtkWidget *CancelButton;
|
|
|
GtkWidget *AddButton;
|
|
|
GtkWidget *PasswordEntry;
|
|
|
GtkWidget *PasswordConfirmationEntry;
|
|
|
unsigned long expire_time;
|
|
|
} key_creation_window;
|
|
|
|
|
|
main_window *setup_window();
|
|
|
|
|
|
void yon_storage_config_update(storage_config_window *window);
|
|
|
|
|
|
void yon_storage_config_update(storage_config_window *window);
|
|
|
|
|
|
void yon_sign_list_update();
|
|
|
|
|
|
void yon_combo_box_text_set_signs(GtkComboBoxText *target);
|
|
|
|
|
|
void on_storage_changed(GtkWidget *self, storage_config_window *window);
|
|
|
|
|
|
config_str yon_tree_store_get_all_at_level(GtkTreeStore *target,GtkTreeIter *parent, int *size, int column, int level);
|
|
|
|
|
|
void on_remove_arch_selection_changed(GtkWidget *self, repo_add_window *window); |