|
|
#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>
|
|
|
#define VTE_INCLUDE
|
|
|
#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-system"
|
|
|
|
|
|
#define _(String) gettext(String)
|
|
|
|
|
|
#define main_icon "com.ublinux.ubl-settings-system"
|
|
|
#define glade_path "/com/ublinux/ui/ubl-settings-system.glade"
|
|
|
#define glade_domain_path "/com/ublinux/ui/ubl-settings-system-domain.glade"
|
|
|
#define glade_connection_path "/com/ublinux/ui/ubl-settings-system-connection.glade"
|
|
|
#define glade_domain_view_path "/com/ublinux/ui/ubl-settings-system-domain-view.glade"
|
|
|
#define glade_locales_path "/com/ublinux/ui/ubl-settings-system-layouts.glade"
|
|
|
#define banner_path "/com/ublinux/images/ubl-settings-system-banner.png"
|
|
|
#define CssPath "/com/ublinux/css/ubl-settings-system.css"
|
|
|
#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
|
|
|
#define locale_transcriptions_path "/usr/share/ubl-settings-system/csv/locales.csv"
|
|
|
|
|
|
#define LocalePath "/usr/share/locale"
|
|
|
#define LocaleName "ubl-settings-system"
|
|
|
|
|
|
#define config_global_load_command "ubconfig --source global get "
|
|
|
#define config_local_load_command "ubconfig --source system get "
|
|
|
|
|
|
#define get_locales_command "/usr/share/ubl-settings-system/csv/locales.csv"
|
|
|
#define get_fonts_command "/usr/share/ubl-settings-system/csv/fonts.csv"
|
|
|
#define get_id_command "/etc/machine-id"
|
|
|
|
|
|
#define config_get_command(source) yon_char_unite("ubconfig --source ", source, " get system HOSTNAME MACHINEID",NULL), yon_char_unite("ubconfig --source ", source, " get locale CONSOLE_FONT LOCALE LANG",NULL), yon_char_unite("ubconfig --source ", source, " get [network] DOMAIN DOMAIN[admanger] DOMAIN[server] DOMAIN[dns] DOMAIN[client]",NULL)
|
|
|
#define config_get_default_command ""
|
|
|
|
|
|
#define config_get_global_only_parameters ""
|
|
|
#define config_get_local_only_parameters ""
|
|
|
|
|
|
#define hostname_parameter "HOSTNAME"
|
|
|
#define id_parameter "MACHINEID"
|
|
|
#define keyboard_layout_parameter "XKBLAYOUT"
|
|
|
#define console_font_parameter "CONSOLE_FONT"
|
|
|
#define num_lock_boot_parameter "NUMLOCK"
|
|
|
#define language_parameter "LANG"
|
|
|
#define locale_parameter "LOCALE"
|
|
|
|
|
|
#define LOCALE_get_command "ubconfig --source global get [locale] LOCALE"
|
|
|
#define HOSTNAME_get_command "ubconfig --source global get [system] HOSTNAME"
|
|
|
#define MACHINEID_get_command "ubconfig --source global get [system] MACHINEID"
|
|
|
#define CONSOLE_FONT_get_command "ubconfig --source global get [locale] CONSOLE_FONT"
|
|
|
// #define NUMLOCK_get_command "ubconfig --source global get [locale] NUMLOCK"
|
|
|
#define LANG_get_command "ubconfig --source global get [locale] LANG"
|
|
|
#define DOMAIN_get_command "ubconfig --source global get [network] DOMAIN"
|
|
|
|
|
|
#define check_domain_access_command(targeet) yon_char_append("adcli info --domain ",target)
|
|
|
#define get_domain_info_command "ubdomain-client list "
|
|
|
#define domains_seek_command "ubdomain-client discover"
|
|
|
#define domain_connect_command(target,user,password, addition) yon_char_unite("ubdomain-client join",!yon_char_is_empty(user)?" --user \"":"",!yon_char_is_empty(user)?user:"",!yon_char_is_empty(user)?"\"":"",!yon_char_is_empty(password)?" --password \"":"",!yon_char_is_empty(password)?password:"",!yon_char_is_empty(password)?"\"":""," --domain \"",target,"\"", addition,NULL)
|
|
|
#define domain_disconnect_command(target,user,password) yon_char_unite("ubdomain-client leave",!yon_char_is_empty(user)?" --user \"":"",!yon_char_is_empty(user)?user:"",!yon_char_is_empty(user)?"\"":"",!yon_char_is_empty(password)?" --password \"":"",!yon_char_is_empty(password)?password:"",!yon_char_is_empty(password)?"\"":""," --domain \"",target,"\"",NULL)
|
|
|
#define kerberos_addition_command(target) yon_char_unite(" --domain_server \"",target,"\"",NULL)
|
|
|
#define dns_addition_command(target) yon_char_unite(" --dns \"",target,"\"",NULL)
|
|
|
#define client_addition_command(target) yon_char_unite(" --domain_client \"",target,"\"",NULL)
|
|
|
|
|
|
#define domain_info(target) yon_char_unite("ubdomain-client discover --domain \"",target,"\"",NULL)
|
|
|
|
|
|
#define domain_connected_icon "com.ublinux.ubl-settings-system.plug-connected-symbolic"
|
|
|
#define domain_disconnected_icon "com.ublinux.ubl-settings-system.plug-disconnected-symbolic"
|
|
|
|
|
|
#define domain_connect_check "ubdomain-client list|grep -q 'configured'"
|
|
|
|
|
|
#define domain_check_alive(target) yon_char_unite("timeout --kill-after=0.1 2 dig +time=1 +tries=1 +noall -t SRV _ldap._tcp.",target," @",target," &>/dev/null",NULL)
|
|
|
|
|
|
#define terminal_command_start(title,command) yon_char_unite("vte-2.91 --name=vte --cursor-shape=ibeam --cursor-blink=off --keep --no-pty --title=\"",title,"\" --no-shell --icon-title --no-context-menu --background-color='rgb(0,0,0)' --foreground-color='rgb(255,255,255)' --whole-window-transparent --no-geometry-hints -- ", command, NULL)
|
|
|
|
|
|
#define DOMAIN "DOMAIN"
|
|
|
#define DOMAIN_ADMANGER "DOMAIN[admanger]"
|
|
|
#define DOMAIN_SERVER "DOMAIN[server]"
|
|
|
#define DOMAIN_DNS "DOMAIN[dns]"
|
|
|
#define DOMAIN_CLIENT "DOMAIN[client]"
|
|
|
|
|
|
|
|
|
typedef char* string;
|
|
|
string version_application;
|
|
|
|
|
|
char *local;
|
|
|
|
|
|
typedef struct {
|
|
|
template_config_fields
|
|
|
GtkListStore *localeslist;
|
|
|
int save_config;
|
|
|
int domain_connected;
|
|
|
GMutex ThreadMutex;
|
|
|
} config;
|
|
|
|
|
|
typedef struct {
|
|
|
template_window_fields
|
|
|
// Custom
|
|
|
GtkWidget *HostnameEntry;
|
|
|
GtkWidget *IDCombo;
|
|
|
GtkWidget *IDEntry;
|
|
|
GtkWidget *IDCopyButton;
|
|
|
GtkWidget *ConsoleFontCombo;
|
|
|
GtkWidget *LanguageCombo;
|
|
|
|
|
|
GtkWidget *LocaleButton;
|
|
|
GtkWidget *LocaleEntry;
|
|
|
|
|
|
GtkWidget *DomainEntry;
|
|
|
GtkWidget *DomainButton;
|
|
|
GtkWidget *FindButton;
|
|
|
|
|
|
GtkListStore *fontlist;
|
|
|
GtkListStore *languagelist;
|
|
|
|
|
|
} main_window;
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *Window;
|
|
|
|
|
|
GtkWidget *HatText;
|
|
|
GtkWidget *HeaderText;
|
|
|
GtkWidget *InfoText;
|
|
|
GtkWidget *AlwaysOpenCheck;
|
|
|
|
|
|
GtkWidget *CloseButton;
|
|
|
GtkWidget *AcceptButton;
|
|
|
} documentation_confirmation_window;
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *Window;
|
|
|
|
|
|
GtkWidget *MainTree;
|
|
|
|
|
|
GtkWidget *CloseButton;
|
|
|
GtkWidget *AcceptButton;
|
|
|
GtkWidget *DefaultCheck;
|
|
|
GtkCellRenderer *ToggleCell;
|
|
|
} locals_window;
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *Window;
|
|
|
|
|
|
GtkWidget *StatusBox;
|
|
|
GtkWidget *HeadLabel;
|
|
|
|
|
|
GtkWidget *CancelButton;
|
|
|
GtkWidget *SaveButton;
|
|
|
GtkWidget *AdressEntry;
|
|
|
GtkWidget *LoginEntry;
|
|
|
GtkWidget *PasswordEntry;
|
|
|
GtkWidget *DNSEntry;
|
|
|
} domain_window;
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *Window;
|
|
|
|
|
|
GtkWidget *StatusBox;
|
|
|
GtkWidget *HeadLabel;
|
|
|
|
|
|
GtkWidget *CancelButton;
|
|
|
GtkWidget *SaveButton;
|
|
|
GtkWidget *AdressEntry;
|
|
|
GtkWidget *LoginEntry;
|
|
|
GtkWidget *PasswordEntry;
|
|
|
GtkWidget *DNSEntry;
|
|
|
GtkWidget *StatusEntry;
|
|
|
GtkWidget *CheckButton;
|
|
|
GtkWidget *KerberosServerEntry;
|
|
|
GtkWidget *ClientCombo;
|
|
|
GtkWidget *AdditionalCombo;
|
|
|
GtkWidget *EditButton;
|
|
|
GtkWidget *SettingsTree;
|
|
|
GtkListStore *list;
|
|
|
guint timer_id;
|
|
|
} connection_window;
|
|
|
|
|
|
typedef struct {
|
|
|
GtkWidget *Window;
|
|
|
GtkWidget *StatusBox;
|
|
|
|
|
|
GtkWidget *HeadLabel;
|
|
|
|
|
|
GtkWidget *ExecuteTerminal;
|
|
|
GtkWidget *TerminalScroll;
|
|
|
} domain_info_window;
|
|
|
|
|
|
main_window *setup_window();
|
|
|
void on_id_changed(GtkEntry *self, main_window *widgets);
|
|
|
|
|
|
void on_check_domain_connected(GtkWidget *self, main_window *widgets);
|
|
|
void yon_interface_update(main_window *widgets);
|
|
|
|
|
|
void on_hostname_changed(GtkEntry *self, main_window *widgets);
|
|
|
void on_language_changed(GtkComboBox *self, main_window *widgets);
|
|
|
void on_console_font_changed(GtkComboBox *self, main_window *widgets);
|
|
|
void on_hostname_changed(GtkEntry *self, main_window *widgets); |