|
|
#include "ubl-settings-services.h"
|
|
|
|
|
|
config main_config;
|
|
|
|
|
|
//saving & loading
|
|
|
|
|
|
void yon_load_proceed(YON_CONFIG_TYPE type){
|
|
|
yon_config_clean();
|
|
|
if (!yon_char_is_empty(config_get_default_command))
|
|
|
yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
|
|
|
if (type==YON_CONFIG_GLOBAL){
|
|
|
yon_config_load_config(type,config_get_global_command,NULL);
|
|
|
}
|
|
|
if (type==YON_CONFIG_LOCAL){
|
|
|
yon_config_load_config(type,config_get_local_command,NULL);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_config_local_load(GtkWidget *self,main_window *widgets){
|
|
|
if (!main_config.update_thread_active){
|
|
|
main_config.update_thread_active=1;
|
|
|
if (self){};
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
yon_ubl_status_box_render(LIST_LOAD_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
gdk_threads_add_idle((GSourceFunc)((gboolean*)(void*)yon_interface_update),widgets);
|
|
|
main_config.load_mode=1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void on_config_global_load(GtkWidget *self,main_window *widgets){
|
|
|
if (!main_config.update_thread_active){
|
|
|
main_config.update_thread_active=1;
|
|
|
if (self){};
|
|
|
yon_load_proceed(YON_CONFIG_GLOBAL);
|
|
|
yon_ubl_status_box_render(LIST_LOAD_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
gdk_threads_add_idle((GSourceFunc)((gboolean*)(void*)yon_interface_update),widgets);
|
|
|
main_config.load_mode=0;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// functions
|
|
|
|
|
|
void on_service_constant_update(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_config_global_local_save(){
|
|
|
yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_global_command,NULL);
|
|
|
}
|
|
|
|
|
|
void on_config_local_save(){
|
|
|
yon_save_proceed("system",YON_CONFIG_LOCAL,config_get_local_command,NULL);
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_config_global_save(){
|
|
|
yon_save_proceed("global",YON_CONFIG_GLOBAL,config_get_global_command,NULL);
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_config_autostart_clicked(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_activate(GtkTreeView *self, main_window *widgets){
|
|
|
if (self&&widgets){};
|
|
|
}
|
|
|
|
|
|
void on_config_autostop_clicked(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_config_block_clicked(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_autostart_clicked(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_kill_confirmed(GtkWidget *self,char *service_name){
|
|
|
if (self&&service_name){};
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_launch_clicked(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_restart_clicked(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_source_show(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_properties_show(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_session_activate(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_session_end(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_session_block(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_status_show(){
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_log_show(){
|
|
|
|
|
|
}
|
|
|
|
|
|
log_window *yon_log_window_new(){
|
|
|
log_window *window = malloc(sizeof(log_window));
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_log);
|
|
|
window->Window = yon_gtk_builder_get_widget(builder,"MonitorWindow");
|
|
|
window->SystemTerminal = yon_gtk_builder_get_widget(builder,"SystemTerminal");
|
|
|
window->TextEditor = yon_gtk_builder_get_widget(builder,"TextEditor");
|
|
|
window->webHeaderNameLabel = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel");
|
|
|
window->UpdateButton = yon_gtk_builder_get_widget(builder,"UpdateButton");
|
|
|
window->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton");
|
|
|
window->target=NULL;
|
|
|
GdkRGBA rgba;
|
|
|
vte_terminal_get_color_background_for_draw(VTE_TERMINAL(window->SystemTerminal),&rgba);
|
|
|
vte_terminal_set_color_cursor(VTE_TERMINAL(window->SystemTerminal),&rgba);
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"terminal_window");
|
|
|
return window;
|
|
|
}
|
|
|
|
|
|
void yon_system_systemd_restart(GtkWidget *self, main_window *widgets){
|
|
|
if (self){};
|
|
|
if (widgets){
|
|
|
if (getuid()!=0&>k_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){
|
|
|
if (system(reload_systemd_root_command)){
|
|
|
yon_ubl_status_box_render("TEXT_ERROR",BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
}
|
|
|
} else {
|
|
|
if (system(reload_systemd_user_command)){
|
|
|
yon_ubl_status_box_render("TEXT_ERROR",BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
typedef void (*data_function)(void*,void*);
|
|
|
|
|
|
void on_system_update_hz_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
|
|
|
data->action_text = "Are you sure?";
|
|
|
data->data = widgets;
|
|
|
data->function = (data_function)yon_system_systemd_restart;
|
|
|
yon_confirmation_dialog_call(self,data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void on_system_update_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
// log_window *window = yon_log_window_new();
|
|
|
|
|
|
// gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_info_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_log_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_edit_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_status_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_filter_changed(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_search(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_inactive_toggled(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_system_unloaded_toggled(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_update_hz_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
// log_window *window = yon_log_window_new();
|
|
|
|
|
|
// gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_update_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_info_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_log_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_edit_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_status_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_filter_changed(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_search(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_inactive_toggled(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_user_unloaded_toggled(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_config_edit_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_session_start_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_session_stop_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void on_session_lock_clicked(GtkWidget *self, main_window *widgets){
|
|
|
if (self){}
|
|
|
if (widgets){
|
|
|
log_window *window = yon_log_window_new();
|
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
gboolean yon_interface_update(main_window *widgets){
|
|
|
if (widgets){
|
|
|
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
void on_column_resize(GtkTreeViewColumn *self,GParamSpec *pspec,main_window *widgets){
|
|
|
if (self||pspec){}
|
|
|
GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->SystemUnitsTree));
|
|
|
int width_configuration = gtk_tree_view_column_get_width(g_list_nth_data(list,0))+gtk_tree_view_column_get_width(g_list_nth_data(list,1))+gtk_tree_view_column_get_width(g_list_nth_data(list,2));
|
|
|
int width_system = gtk_tree_view_column_get_width(g_list_nth_data(list,3))+gtk_tree_view_column_get_width(g_list_nth_data(list,4))+gtk_tree_view_column_get_width(g_list_nth_data(list,5));
|
|
|
g_list_free(list);
|
|
|
gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column(GTK_TREE_VIEW(widgets->SystemUpperTree),0),width_configuration);
|
|
|
gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column(GTK_TREE_VIEW(widgets->SystemUpperTree),1),width_system);
|
|
|
|
|
|
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->UserUnitsTree));
|
|
|
width_configuration = gtk_tree_view_column_get_width(g_list_nth_data(list,0))+gtk_tree_view_column_get_width(g_list_nth_data(list,1))+gtk_tree_view_column_get_width(g_list_nth_data(list,2));
|
|
|
width_system = gtk_tree_view_column_get_width(g_list_nth_data(list,3))+gtk_tree_view_column_get_width(g_list_nth_data(list,4))+gtk_tree_view_column_get_width(g_list_nth_data(list,5));
|
|
|
g_list_free(list);
|
|
|
gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column(GTK_TREE_VIEW(widgets->UsersUpperTree),0),width_configuration);
|
|
|
gtk_tree_view_column_set_fixed_width(gtk_tree_view_get_column(GTK_TREE_VIEW(widgets->UsersUpperTree),1),width_system);
|
|
|
}
|
|
|
|
|
|
/**config_init()
|
|
|
* [EN]
|
|
|
*
|
|
|
* [RU]
|
|
|
* Функция инициализации всех параметров конфигурации
|
|
|
*/
|
|
|
void config_init(){
|
|
|
main_config.always_open_documentation=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.load_mode=1;
|
|
|
main_config.update_thread_active=0;
|
|
|
}
|
|
|
|
|
|
void on_tree_selection_changed(GtkWidget *self, main_window *widgets){
|
|
|
if (self){};
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->SystemList);
|
|
|
GtkTreeIter iter;
|
|
|
// int switch_status=0;
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SystemUnitsTree)),&model,&iter)){
|
|
|
// switch_status=1;
|
|
|
}
|
|
|
if (getuid()==0){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**yon_main_window_complete(main_window *widgets)
|
|
|
* [EN]
|
|
|
*
|
|
|
* [RU]
|
|
|
* Функция настройки основного окна приложения. [widgets] - структура со стандартным интерфейсом.
|
|
|
*/
|
|
|
void yon_main_window_complete(main_window *widgets){
|
|
|
widgets = yon_remalloc(widgets,sizeof(main_window));
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
|
|
|
gtk_box_pack_start(GTK_BOX(widgets->InterfaceBox),yon_gtk_builder_get_widget(builder,"BoxMain"),1,1,0);
|
|
|
// Custom widgets configuration
|
|
|
{
|
|
|
widgets->UserList=GTK_LIST_STORE(gtk_builder_get_object(builder,"UserList"));
|
|
|
widgets->TimersList =GTK_LIST_STORE(gtk_builder_get_object(builder,"TimersList"));
|
|
|
widgets->SessionsList=GTK_LIST_STORE(gtk_builder_get_object(builder,"SessionsList"));
|
|
|
widgets->ConfigList=GTK_LIST_STORE(gtk_builder_get_object(builder,"ConfigList"));
|
|
|
widgets->SystemList=GTK_LIST_STORE(gtk_builder_get_object(builder,"SystemList"));
|
|
|
widgets->BoxMain=yon_gtk_builder_get_widget(builder,"BoxMain");
|
|
|
widgets->SystemSearchEntry=yon_gtk_builder_get_widget(builder,"SystemSearchEntry");
|
|
|
widgets->SystemUpperTree=yon_gtk_builder_get_widget(builder,"SystemUpperTree");
|
|
|
widgets->SystemUnitsTree=yon_gtk_builder_get_widget(builder,"SystemUnitsTree");
|
|
|
widgets->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook");
|
|
|
|
|
|
widgets->SystemSearchEntry=yon_gtk_builder_get_widget(builder,"SystemSearchEntry");
|
|
|
widgets->SystemFiltersCombo=yon_gtk_builder_get_widget(builder,"SystemFiltersCombo");
|
|
|
widgets->SystemInactiveShowCheck=yon_gtk_builder_get_widget(builder,"SystemInactiveShowCheck");
|
|
|
widgets->SystemUnloadedShowCheck=yon_gtk_builder_get_widget(builder,"SystemUnloadedShowCheck");
|
|
|
widgets->SystemUpperTree=yon_gtk_builder_get_widget(builder,"SystemUpperTree");
|
|
|
widgets->SystemUnitsTree=yon_gtk_builder_get_widget(builder,"SystemUnitsTree");
|
|
|
widgets->SystemPrevButton=yon_gtk_builder_get_widget(builder,"SystemPrevButton");
|
|
|
widgets->SystemUpdateButton=yon_gtk_builder_get_widget(builder,"SystemUpdateButton");
|
|
|
widgets->SystemInfoButton=yon_gtk_builder_get_widget(builder,"SystemInfoButton");
|
|
|
widgets->SystemLogButton=yon_gtk_builder_get_widget(builder,"SystemLogButton");
|
|
|
widgets->SystemEditButton=yon_gtk_builder_get_widget(builder,"SystemEditButton");
|
|
|
widgets->SystemPropertiesButton=yon_gtk_builder_get_widget(builder,"SystemPropertiesButton");
|
|
|
widgets->SystemStatusButton=yon_gtk_builder_get_widget(builder,"SystemStatusButton");
|
|
|
widgets->SystemMenu = yon_rmb_menu_setup(widgets->SystemUnitsTree,NULL,NULL,
|
|
|
CONFIGURE_CONFIGURATION_LABEL,NULL,NULL,NULL,
|
|
|
AUTOSTART_LABEL,play_icon_path,on_config_autostart_clicked,widgets,
|
|
|
AUTOSTOP_LABEL,stop_icon_path,on_config_autostop_clicked,widgets,
|
|
|
BLOCK_LABEL,block_icon_path,on_config_block_clicked,widgets,
|
|
|
SYSTEM_CONFIGURATION_LABEL,NULL,NULL,NULL,
|
|
|
AUTOSTART_LABEL,start_icon_path,on_system_autostart_clicked,widgets,
|
|
|
LAUNCHED_LABEL,launch_icon_path,on_system_launch_clicked,widgets,
|
|
|
RESTART_LABEL,update_icon_path,on_system_restart_clicked,widgets,
|
|
|
STATUS_LABEL,status_icon_path,on_status_show,widgets,
|
|
|
SHOW_LOG_LABEL,log_icon_path,on_log_show,widgets,
|
|
|
SHOW_SOURCE_LABEL,source_icon_path,on_source_show,widgets,
|
|
|
PROPERTIES_LABEL,properties_icon_path,on_properties_show,widgets,
|
|
|
NULL);
|
|
|
|
|
|
widgets->UserSearchEntry=yon_gtk_builder_get_widget(builder,"UserSearchEntry");
|
|
|
widgets->UserFiltersCombo=yon_gtk_builder_get_widget(builder,"UserFiltersCombo");
|
|
|
widgets->UserInactiveShowCheck=yon_gtk_builder_get_widget(builder,"UserInactiveShowCheck");
|
|
|
widgets->UserUnloadedShowCheck=yon_gtk_builder_get_widget(builder,"UserUnloadedShowCheck");
|
|
|
widgets->UsersUpperTree=yon_gtk_builder_get_widget(builder,"UsersUpperTree");
|
|
|
widgets->UserUnitsTree=yon_gtk_builder_get_widget(builder,"UserUnitsTree");
|
|
|
widgets->UserPrevButton=yon_gtk_builder_get_widget(builder,"UserPrevButton");
|
|
|
widgets->UserUpdateButton=yon_gtk_builder_get_widget(builder,"UserUpdateButton");
|
|
|
widgets->UserInfoButton=yon_gtk_builder_get_widget(builder,"UserInfoButton");
|
|
|
widgets->UserLogButton=yon_gtk_builder_get_widget(builder,"UserLogButton");
|
|
|
widgets->UserEditButton=yon_gtk_builder_get_widget(builder,"UserEditButton");
|
|
|
widgets->UserStatusButton=yon_gtk_builder_get_widget(builder,"UserStatusButton");
|
|
|
widgets->UserServiceLabel=yon_gtk_builder_get_widget(builder,"UserServiceLabel");
|
|
|
widgets->UserDescriptionLabel=yon_gtk_builder_get_widget(builder,"UserDescriptionLabel");
|
|
|
widgets->UserMenu = yon_rmb_menu_setup(widgets->UserUnitsTree,NULL,NULL,
|
|
|
CONFIGURE_CONFIGURATION_LABEL,NULL,NULL,NULL,
|
|
|
AUTOSTART_LABEL,play_icon_path,on_config_autostart_clicked,widgets,
|
|
|
AUTOSTOP_LABEL,stop_icon_path,on_config_autostop_clicked,widgets,
|
|
|
BLOCK_LABEL,block_icon_path,on_config_block_clicked,widgets,
|
|
|
SYSTEM_CONFIGURATION_LABEL,NULL,NULL,NULL,
|
|
|
AUTOSTART_LABEL,start_icon_path,on_system_autostart_clicked,widgets,
|
|
|
LAUNCHED_LABEL,launch_icon_path,on_system_launch_clicked,widgets,
|
|
|
RESTART_LABEL,update_icon_path,on_system_restart_clicked,widgets,
|
|
|
STATUS_LABEL,status_icon_path,on_status_show,widgets,
|
|
|
SHOW_LOG_LABEL,log_icon_path,on_log_show,widgets,
|
|
|
SHOW_SOURCE_LABEL,source_icon_path,on_source_show,widgets,
|
|
|
PROPERTIES_LABEL,properties_icon_path,on_properties_show,widgets,
|
|
|
NULL);
|
|
|
|
|
|
widgets->ConfigEditButton=yon_gtk_builder_get_widget(builder,"ConfigEditButton");
|
|
|
widgets->ConfigMainTree=yon_gtk_builder_get_widget(builder,"ConfigMainTree");
|
|
|
|
|
|
widgets->SessionMainTree=yon_gtk_builder_get_widget(builder,"SessionMainTree");
|
|
|
widgets->SessionStartButton=yon_gtk_builder_get_widget(builder,"SessionStartButton");
|
|
|
widgets->SessionStopButton=yon_gtk_builder_get_widget(builder,"SessionStopButton");
|
|
|
widgets->SessionBlockButton=yon_gtk_builder_get_widget(builder,"SessionBlockButton");
|
|
|
widgets->SessionMenu = yon_rmb_menu_setup(widgets->SessionMainTree,NULL,NULL,
|
|
|
ACTIVATE_SESSION_LABEL,play_icon_path,on_session_activate,NULL,
|
|
|
END_SESSION_LABEL,stop_icon_path,on_session_end,NULL,
|
|
|
BLOCK_SESSION_LABEL,block_icon_path,on_session_block,NULL,
|
|
|
NULL);
|
|
|
|
|
|
widgets->SystemServiceLabel=yon_gtk_builder_get_widget(builder,"SystemServiceLabel");
|
|
|
widgets->SystemDescriptionLabel=yon_gtk_builder_get_widget(builder,"SystemDescriptionLabel");
|
|
|
}
|
|
|
widgets->TimersMainTree=yon_gtk_builder_get_widget(builder,"TimersMainTree");
|
|
|
GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->SystemUnitsTree));
|
|
|
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(widgets->SystemUnitsTree));
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemPrevButton),"clicked",G_CALLBACK(on_system_update_hz_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemUpdateButton),"clicked",G_CALLBACK(on_system_update_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemInfoButton),"clicked",G_CALLBACK(on_system_info_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemLogButton),"clicked",G_CALLBACK(on_system_log_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemEditButton),"clicked",G_CALLBACK(on_system_edit_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemStatusButton),"clicked",G_CALLBACK(on_system_status_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemFiltersCombo),"changed",G_CALLBACK(on_system_filter_changed),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemSearchEntry),"changed",G_CALLBACK(on_system_search),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemInactiveShowCheck),"toggled",G_CALLBACK(on_system_inactive_toggled),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemUnloadedShowCheck),"toggled",G_CALLBACK(on_system_unloaded_toggled),widgets);
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->UserPrevButton),"clicked",G_CALLBACK(on_user_update_hz_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserUpdateButton),"clicked",G_CALLBACK(on_user_update_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserInfoButton),"clicked",G_CALLBACK(on_user_info_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserLogButton),"clicked",G_CALLBACK(on_user_log_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserEditButton),"clicked",G_CALLBACK(on_user_edit_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserStatusButton),"clicked",G_CALLBACK(on_user_status_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserFiltersCombo),"changed",G_CALLBACK(on_user_filter_changed),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserSearchEntry),"changed",G_CALLBACK(on_user_search),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserInactiveShowCheck),"toggled",G_CALLBACK(on_user_inactive_toggled),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->UserUnloadedShowCheck),"toggled",G_CALLBACK(on_user_unloaded_toggled),widgets);
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ConfigEditButton),"clicked",G_CALLBACK(on_config_edit_clicked),widgets);
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionStartButton),"clicked",G_CALLBACK(on_session_start_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionStopButton),"clicked",G_CALLBACK(on_session_stop_clicked),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionBlockButton),"clicked",G_CALLBACK(on_session_lock_clicked),widgets);
|
|
|
|
|
|
|
|
|
// g_signal_connect(G_OBJECT(widgets->SystemUnitsTree),"button-press-event",G_CALLBACK(on_context_menu_open),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,0)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,1)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,2)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,3)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,4)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,5)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
for (unsigned int i=0;i<g_list_length(list);i++){
|
|
|
yon_window_config_add_listener(g_list_nth_data(list,i),yon_char_append("SystemUnitsColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
}
|
|
|
g_list_free(list);
|
|
|
|
|
|
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->UserUnitsTree));
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,0)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,1)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,2)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,3)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,4)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,5)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
for (unsigned int i=0;i<g_list_length(list);i++){
|
|
|
yon_window_config_add_listener(g_list_nth_data(list,i),yon_char_append("UserUnitsColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
}
|
|
|
g_list_free(list);
|
|
|
|
|
|
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->ConfigMainTree));
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,0)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,1)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,2)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
for (unsigned int i=0;i<g_list_length(list);i++){
|
|
|
yon_window_config_add_listener(g_list_nth_data(list,i),yon_char_append("ConfigUnitsColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
}
|
|
|
g_list_free(list);
|
|
|
|
|
|
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->SessionMainTree));
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,0)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,1)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,2)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,3)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,4)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
for (unsigned int i=0;i<g_list_length(list);i++){
|
|
|
yon_window_config_add_listener(g_list_nth_data(list,i),yon_char_append("SessionsUnitsColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
}
|
|
|
g_list_free(list);
|
|
|
|
|
|
list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->TimersMainTree));
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,0)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,1)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,2)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,3)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,4)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
g_signal_connect(G_OBJECT(g_list_nth_data(list,5)),"notify::width",G_CALLBACK(on_column_resize),widgets);
|
|
|
for (unsigned int i=0;i<g_list_length(list);i++){
|
|
|
yon_window_config_add_listener(g_list_nth_data(list,i),yon_char_append("TimersUnitsColumn",yon_char_from_int(i)),"fixed-width",YON_TYPE_INT);
|
|
|
}
|
|
|
g_list_free(list);
|
|
|
// g_signal_connect(G_OBJECT(widgets->SystemUnitsTree),"cursor-changed",G_CALLBACK(on_activate),widgets);
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets);
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadGlobalMenuItem),"activate",G_CALLBACK(on_config_global_load),widgets);
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveMenuItem),"activate",G_CALLBACK(on_config_global_local_save),NULL);
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveLocalMenuItem),"activate",G_CALLBACK(on_config_local_save),NULL);
|
|
|
g_signal_connect(G_OBJECT(widgets->SaveGlobalMenuItem),"activate",G_CALLBACK(on_config_global_save),NULL);
|
|
|
g_signal_connect(G_OBJECT(widgets->SystemUnitsTree),"cursor-changed",G_CALLBACK(on_tree_selection_changed),widgets);
|
|
|
gtk_tree_view_set_search_entry(GTK_TREE_VIEW(widgets->SystemUnitsTree),GTK_ENTRY(widgets->SystemSearchEntry));
|
|
|
yon_load_proceed(YON_CONFIG_LOCAL);
|
|
|
yon_ubl_status_box_render(LIST_LOAD_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
if (!main_config.update_thread_active){
|
|
|
main_config.update_thread_active=1;
|
|
|
pthread_t tid;
|
|
|
pthread_create(&tid,NULL,(void*)(void*)((yon_interface_update)),widgets);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int main(int argc, char *argv[]){
|
|
|
local=setlocale(LC_ALL, "");
|
|
|
textdomain (LocaleName);
|
|
|
config_init();
|
|
|
|
|
|
yon_ubl_connect_config((_template_config*)&main_config);
|
|
|
yon_ubl_window_init(TITLE_LABEL,TITLE_INFO_LABEL,LocaleName,CssPath,LocaleName,version_application,WIKI_LINK);
|
|
|
config_str unfound = NULL;
|
|
|
int size=0;
|
|
|
yon_ubl_setup_arguments(argc,argv,&unfound,&size,NULL);
|
|
|
gtk_init(&argc,&argv);
|
|
|
template_main_window *widgets = yon_ubl_window_setup();
|
|
|
yon_main_window_complete((main_window*)widgets);
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
yon_window_config_load(path);
|
|
|
if (getuid()!=0)
|
|
|
yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
gtk_main();
|
|
|
return 0;
|
|
|
} |