You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ubl-settings-repomanager/source/ubl-settings-repomanager.h

148 lines
5.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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_config "/com/ublinux/ui/ubl-settings-repomanager-filechooser.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"
typedef char* string;
#define get_package_info_command(filename) yon_char_unite("LC_ALL=EN pacman -Q --info --file ",filename," |sed -e 's/ */ /g' -e 's/ : /:/g' -e 's/\\n/ /g'",NULL)
#define get_saved_package_info_command(path,filename) yon_char_unite("LC_ALL=EN pacman -Q --info --file $(find \"",path,"\" -name \"*",filename,"*\" -not -name *.sig |head -n 1)|sed -e 's/ */ /g' -e 's/ : /:/g' -e 's/\\n/ /g'",NULL)
#define get_gpg_keys_command yon_char_unite(yon_ubl_check_root()==1 ? yon_char_unite("su - ",yon_ubl_root_user_get()," -c \"gpg --list-signatures\"",NULL):"gpg --list-signatures"," | grep '^sig 3' | cut -d' ' -f10,11,13- | sort -u |sed -e 's/[0-9]*-[0-9]*-[0-9]* //g'",NULL)
#define create_storage_command(path,name) yon_char_unite("repo-manager add -r '",name,"' -d '", path,"'",NULL)
#define add_packages_command(path,name,packages_path) yon_char_unite("repo-manager add -r '",name,"' -d '", path,"' ",packages_path,NULL)
#define remove_packages_command(path,name,packages_path) yon_char_unite("repo-manager remove -r '",name,"' -d '", path,"' ",packages_path,NULL)
#define yon_move_packages_command(storage, source_repo, target_repo, packages) yon_char_unite("repo-manager move -d '",storage,"' -R '",source_repo,"' -r '",target_repo,"' ", packages,NULL)
string version_application;
char *local;
typedef struct {
template_config_fields
GtkTreeStore *tree_store;
int lock_root;
} 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;
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 *CancelButton;
GtkWidget *ChooseButton;
GtkWidget *NameEntry;
GtkWidget *FileChooserWidget;
char *root_path;
} file_chooser_window;
main_window *setup_window();
void yon_storage_config_update(storage_config_window *window);