@ -13,6 +13,7 @@
# include <libublsettings-gtk3.h>
# include <libublsettingsui-gtk3.h>
# include <time.h>
# include <json-c/json.h>
# ifdef WEBKIT_FOUND
# include <webkit2/webkit2.h>
# endif
@ -23,8 +24,7 @@
# define _(String) gettext(String)
# define glade_path " / com / ublinux / ui / ubl-settings-services.glade"
# define glade_path_terminal " / com / ublinux / ui / ubl-settings-services-terminal.glade"
# define glade_path_log " / com / ublinux / ui / ubl-settings-services-log.glade"
# define glade_path_log " / com / ublinux / ui / ubl-settings-services-terminal.glade"
# define banner_path " / com / ublinux / images / ubl-settings-services-banner.png"
# define CssPath " / com / ublinux / css / ubl-settings-services.css"
@ -33,20 +33,84 @@
# define LocalePath " / usr / share / locale"
# define LocaleName "ubl-settings-services"
# define load_services_command "systemctl list-units -- type=service --type=socket --no-pager --all |grep -E \"^ \" |grep -v \"UNIT\" |sed -e 's/ * / ; / g' -e 's / ^; //g' -e 's/running /running;/g' -e 's/inactive /inactive;/g'"
# define load_user_services_command yon_char_unite("systemctl --user --machine=",yon_ubl_root_user_get(),"@ list-units -- type=service --type=socket --no-pager --all |grep -E \"^ \" |grep -v \"UNIT\" |sed -e 's/ * / ; / g' -e 's / ^; //g'",NULL)
# define load_system_services_command "systemctl --system list-units -- type=service --type=socket -- no-pager --all |grep -E \"^ \" |grep -v \"UNIT\" |sed -e 's/ * / ; / g' -e 's / ^; //g' |cut -f1 -d';'"
# define load_enabled_command "systemctl list-unit-files -- type=service --type=socket -- no-pager --state=enabled --all |sed -e 's/ * / : / g' -e 's / *: * / : / g'|cut -f1 -d:"
# define load_launched_command "systemctl list-units -- type=service --type=socket -- no-pager --state=active --all --no-legend|sed -e 's/ ^ //g' -e 's/ */:/g' |cut -f1 -d:"
# define load_services_command "systemctl list-units -- no-pager --all --plain --no-legend |sed -E 's/ (\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*) / \\1;\\2;\\3;\\4;\\5 / '"
# define load_user_services_command yon_char_unite("systemctl --user --machine=",yon_ubl_root_user_get(),"@ list-units -- no-pager --all --plain --no-legend |sed -E 's/ (\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*) / \\1;\\2;\\3;\\4;\\5 / '",NULL)
# define load_system_services_command "systemctl --system list-units -- no-pager --all |grep -E \"^ \" |grep -v \"UNIT\" |sed -e 's/ * / ; / g' -e 's / ^; //g' |cut -f1 -d';'"
# define load_enabled_command "systemctl list-unit-files -- no-pager --state=enabled --all |sed -e 's/ * / : / g' -e 's / *: * / : / g'|cut -f1 -d:"
# define load_launched_command "systemctl list-units -- no-pager --state=active --all --no-legend|sed -e 's/ ^ //g' -e 's/ */:/g' |cut -f1 -d:"
# define service_start_command(target) yon_char_append("systemctl start --no-pager ",target)
# define service_stop_command(target) yon_char_append("systemctl stop --no-pager ",target)
# define service_enable_command(target) yon_char_append("systemctl enable --no-pager ",target)
# define service_disable_command(target) yon_char_append("systemctl disable --no-pager ",target)
# define service_info_command(target) yon_char_append("systemctl status -l --no-pager ",target)
# define service_kill_command(target) yon_char_append("systemctl kill ",target)
# define service_check_active_command(target) yon_char_append("systemctl is-active ",target)
# define start_log_command(target) yon_char_append("journalctl --all --no-pager --unit ",target)
# define service_info_command(target) yon_char_append("systemctl status -l --no-pager ",target)
# define get_log_command(target) yon_char_append("journalctl --all --no-pager --unit ",target)
# define show_source_command(target) yon_char_append("systemctl edit --full ",target)
# define properties_command(target) yon_char_append("systemctl show --no-pager ",target)
# define user_service_info_command(target) yon_char_unite("systemctl --user --machine=",yon_ubl_root_user_get(),"@ status -l --no-pager ",target,NULL)
# define user_get_log_command(target) yon_char_unite("usermod -a -G systemd-journal ",yon_ubl_root_user_get(),";journalctl --user -u --all --no-pager --unit ",target,NULL)
# define user_show_source_command(target) yon_char_unite("systemctl edit --full ",target,NULL)
# define user_properties_command(target) yon_char_unite("systemctl --user --machine=",yon_ubl_root_user_get(),"@ show --no-pager ",target,NULL)
# define get_config_files_command "find / etc / systemd -iname *.conf -exec du -sh --time {} \\;|sed -e 's / \t / ; / g'"
# define system_services_status_command "systemctl status --no-pager"
# define user_services_status_command yon_char_unite("systemctl --user --machine=",yon_ubl_root_user_get(),"@ status --no-pager",NULL)
# define installed_units_states_command "systemctl list-unit-files --no-pager"
# define list_of_units_states_command "systemctl list-units --all --no-pager"
# define list_of_sockets_states_command "systemctl list-sockets --all --no-pager"
# define list_of_timers_states_command "systemctl list-timers --all --no-pager"
# define get_timers_command "systemctl list-timers --all --no-pager --plain --no-legend --output=json"
# define installed_units_command "systemctl list-unit-files --no-pager| sed -e 's / * / ; / g'"
# define list_of_units_command "systemctl list-units --all --no-pager| sed -e 's / * / ; / g'"
# define list_of_sockets_command "systemctl list-sockets --all --no-pager| sed -e 's / * / ; / g'"
# define list_of_timers_command "systemctl list-timers --all --no-pager| sed -e 's / * / ; / g'"
# define list_of_session_command "while IFS=\" \" read -r GET_SESSION GET_UID GET_USER GET_SEAT GET_TTY; do echo -e \"${GET_SESSION} $(loginctl session-status ${GET_SESSION} --no-page | sed -Enr \"s / ^\\s*State: (.*)$ / \1 / p\") ${GET_UID} ${GET_USER} ${GET_SEAT} ${GET_TTY}\"; done < <(loginctl list-sessions --no-legend)"
# define config_get_command(target) yon_char_append("cat ",target)
# define yon_config_get_custom_command(target) yon_char_unite("ubconfig --source ",target," get system SERVICES_ENABLE SERVICES_DISABLE SERVICES_MASK",NULL)
# define config_get_local_command "ubconfig --source system get system SERVICES_ENABLE SERVICES_DISABLE SERVICES_MASK"
# define config_get_global_command yon_char_new("ubconfig --source global get system SERVICES_ENABLE SERVICES_DISABLE SERVICES_MASK")
# define config_get_default_command ""
# define config_get_global_only_parameters ""
# define config_get_local_only_parameters ""
# define SERVICES_ENABLE_get_command "ubconfig --source global get [system] SERVICES_ENABLE"
# define SERVICES_DISABLE_get_command "ubconfig --source global get [system] SERVICES_DISABLE"
# define SERVICES_MASK_get_command "ubconfig --source global get [system] SERVICES_MASK"
# define CONSOLE_FONT_get_command "ubconfig --source global get [locale] CONSOLE_FONT"
# define play_icon_path "com.ublinux.ubl-settings-services.play-symbolic"
# define stop_icon_path "com.ublinux.ubl-settings-services.stop-symbolic"
# define block_icon_path "com.ublinux.ubl-settings-services.cancel-symbolic"
# define start_icon_path "com.ublinux.ubl-settings-services.launch-symbolic"
# define update_icon_path "com.ublinux.ubl-settings-services.sync-symbolic"
# define launch_icon_path "com.ublinux.ubl-settings-services.check-symbolic"
# define log_icon_path "com.ublinux.ubl-settings-services.lookup-symbolic"
# define source_icon_path "com.ublinux.ubl-settings-services.source-symbolic"
# define properties_icon_path "com.ublinux.ubl-settings-services.properties-symbolic"
# define status_icon_path "com.ublinux.ubl-settings-services.important-symbolic"
# define reload_systemd_root_command "systemctl daemon-reload"
# define reexec_systemd_root_command "systemctl daemon-reexec"
# define reload_systemd_user_command "systemctl --user daemon-reload"
# define reexec_systemd_user_command "systemctl --user daemon-reexec"
# define session_activate_session(target) yon_char_append("loginctl activate ",target)
# define session_terminate_session(target) yon_char_append("loginctl terminate-session ",target)
# define session_lock_session(target) yon_char_append("loginctl lock-session ",target)
# define session_unlock_session(target) yon_char_append("loginctl unlock-session ",target)
# define SERVICES_ENABLE_PARAMETER "SERVICES_ENABLE"
# define SERVICES_DISABLE_PARAMETER "SERVICES_DISABLE"
# define SERVICES_MASK_PARAMETER "SERVICES_MASK"
typedef char * string ;
string version_application ;
@ -54,22 +118,7 @@ string version_application;
char * local ;
typedef struct {
// Standard config. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_config STRUCT {
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 ;
int lock_load_system ;
int load_mode ;
int always_open_documentation ;
// } Standard config. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_config STRUCT
// Type custom parameters below:
template_config_fields
int rmb_clicked ;
GtkTreeModel * ServiceFilter ;
GtkTreeModel * SocketFilter ;
@ -79,72 +128,86 @@ typedef struct {
GtkTreeModel * SourceFilter ;
int update_thread_active ;
config_str launch_arguments ;
int launch_size ;
int save_config ;
} config ;
typedef struct {
GtkWidget * Menu ;
GtkWidget * MenuConfigAutostart ;
GtkWidget * MenuConfigAutostop ;
GtkWidget * MenuConfigBlock ;
GtkWidget * MenuSystemAutostart ;
GtkWidget * MenuSystemLaunched ;
GtkWidget * MenuReloadConfig ;
GtkWidget * MenuStatus ;
} menu_obj ;
typedef struct {
// Standard widgets. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_main_window STRUCT {
GtkWidget * Window ;
GtkWidget * HeadLabel ;
GtkWidget * PlugBox ;
GtkWidget * HeadOverlay ;
GtkWidget * HeadImage ;
GtkWidget * HeadBox ;
GtkWidget * HeadTitleLabel ;
GtkWidget * HeadInfoLabel ;
GtkWidget * StatusBox ;
GtkWidget * StatusIcon ;
GtkWidget * StatusLabel ;
GtkWidget * SaveMenuItem ;
GtkWidget * SaveGlobalMenuItem ;
GtkWidget * SaveLocalMenuItem ;
GtkWidget * RightBox ;
GtkWidget * LoadGlobalMenuItem ;
GtkWidget * LoadLocalMenuItem ;
GtkWidget * LeftBox ;
GtkWidget * DocumentationMenuItem ;
GtkWidget * AboutMenuItem ;
GtkWidget * InterfaceBox ;
// } Standard widgets. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_main_window STRUCT
// Type custom parameters below:
GtkListStore * liststore1 ;
GtkListStore * liststore2 ;
template_window_fields
GtkListStore * UserList ;
GtkListStore * TimersList ;
GtkListStore * SessionsList ;
GtkListStore * ConfigList ;
GtkListStore * SystemList ;
GtkWidget * BoxMain ;
GtkWidget * ServiceSourceCombo ;
GtkWidget * ServiceTypeCombo ;
GtkWidget * SearchEntry ;
GtkWidget * UpdateButton ;
GtkWidget * ConfigAutostartButton ;
GtkWidget * ConfigAutostopButton ;
GtkWidget * ConfigBlockButton ;
GtkWidget * SystemAutostartButton ;
GtkWidget * SystemLaunchButton ;
GtkWidget * InfoButton ;
GtkWidget * LogButton ;
GtkWidget * MainUpperTree ;
GtkWidget * MainTree ;
GtkWidget * RMBMenu ;
menu_obj * menu ;
GtkWidget * ServiceLabel ;
GtkWidget * DescriptionLabel ;
GtkWidget * SystemSearchEntry ;
GtkWidget * SystemFiltersCombo ;
GtkWidget * SystemInactiveShowCheck ;
GtkWidget * SystemUnloadedShowCheck ;
GtkWidget * SystemUpperTree ;
GtkWidget * SystemUnitsTree ;
GtkWidget * SystemPrevButton ;
GtkWidget * SystemUpdateButton ;
GtkWidget * SystemInfoButton ;
GtkWidget * SystemLogButton ;
GtkWidget * SystemEditButton ;
GtkWidget * SystemPropertiesButton ;
GtkWidget * SystemStatusButton ;
rmb_menu_window * SystemMenu ;
GtkWidget * SystemServiceLabel ;
GtkWidget * SystemDescriptionLabel ;
GtkWidget * UserSearchEntry ;
GtkWidget * UserFiltersCombo ;
GtkWidget * UserInactiveShowCheck ;
GtkWidget * UserUnloadedShowCheck ;
GtkWidget * UsersUpperTree ;
GtkWidget * UserUnitsTree ;
GtkWidget * UserPrevButton ;
GtkWidget * UserUpdateButton ;
GtkWidget * UserInfoButton ;
GtkWidget * UserLogButton ;
GtkWidget * UserEditButton ;
GtkWidget * UserStatusButton ;
rmb_menu_window * UserMenu ;
GtkWidget * UserServiceLabel ;
GtkWidget * UserDescriptionLabel ;
GtkWidget * ConfigEditButton ;
GtkWidget * ConfigMainTree ;
GtkWidget * SessionMainTree ;
GtkWidget * SessionStartButton ;
GtkWidget * SessionStopButton ;
GtkWidget * SessionBlockButton ;
rmb_menu_window * SessionMenu ;
GtkWidget * TimersMainTree ;
GtkWidget * MainNotebook ;
GtkWidget * SystemServicesStatusMenuItem ;
GtkWidget * UserServicesStatusMenuItem ;
GtkWidget * InstalledUnitsStatusMenuItem ;
GtkWidget * UnitsStatusListMenuItem ;
GtkWidget * SocketsStatusListMenuItem ;
GtkWidget * TimersStatusListMenuItem ;
GtkTreeModelFilter * SystemFilter ;
GtkTreeModelFilter * UserFilter ;
GtkCellRenderer * ConfigAutostartCell ;
GtkCellRenderer * ConfigAutostopCell ;
GtkCellRenderer * ConfigBlockCell ;
GtkCellRenderer * SystemAutostartCell ;
GtkCellRenderer * SystemLaunchedCell ;
GtkCellRenderer * UserConfigAutostartCell ;
GtkCellRenderer * UserConfigAutostopCell ;
GtkCellRenderer * UserConfigBlockCell ;
GtkCellRenderer * UserSystemAutostartCell ;
GtkCellRenderer * UserSystemLaunchedCell ;
} main_window ;
typedef struct {
@ -175,18 +238,16 @@ typedef struct{
GtkWidget * MainTree ;
} bl_settings_services_window ;
typedef struct {
GtkWidget * Window ;
GtkWidget * UpdateButton ;
GtkWidget * SystemTerminal ;
GtkWidget * webHeaderNameLabel ;
char * target ;
} terminal_window ;
typedef struct {
GtkWidget * Window ;
GtkWidget * SystemTerminal ;
GtkWidget * TerminalScroll ;
GtkWidget * TextEditor ;
GtkWidget * webHeaderNameLabel ;
GtkWidget * UpdateButton ;
GtkWidget * SaveButton ;
GtkWidget * StatusBox ;
GtkAdjustment * adjustment ;
char * target ;
} log_window ;
@ -194,14 +255,35 @@ void on_config_local_load(GtkWidget *self,main_window *widgets);
void on_config_global_load ( GtkWidget * self , main_window * widgets ) ;
void on_config_custom_load ( GtkWidget * self , main_window * widgets ) ;
void on_config_global_local_save ( ) ;
void on_config_local_save ( ) ;
void on_config_global_save ( ) ;
void on_config_custom_save ( GtkWidget * self , main_window * widgets ) ;
void on_service_constant_update ( ) ;
log_window * yon_log_window_new ( ) ;
gboolean yon_filter ( GtkTreeModel * model , GtkTreeIter * iter , main_window * widgets ) ;
void on_filter_changed ( GtkWidget * self , main_window * widgets ) ;
void on_system_services_status ( GtkWidget * self , main_window * widgets ) ;
void on_user_services_status ( GtkWidget * self , main_window * widgets ) ;
void on_units_status ( GtkWidget * self , main_window * widgets ) ;
void on_units_list_status ( GtkWidget * self , main_window * widgets ) ;
void on_sockets_list_status ( GtkWidget * self , main_window * widgets ) ;
void on_timers_list_status ( GtkWidget * self , main_window * widgets ) ;
gboolean yon_interface_update ( main_window * widgets ) ;
GtkWidget * yon_menu_button_create ( char * icon_name , char * text ) ;
@ -212,19 +294,70 @@ gboolean on_context_menu_open(GtkWidget *self,GdkEventButton *event, main_window
GtkWidget * yon_menu_separator_create ( ) ;
void on_config_autostart_clicked ( ) ;
void on_config_autostart_clicked ( GtkCellRenderer * self , char * path , main_window * widgets ) ;
void on_activate ( GtkTreeView * self , main_window * widgets ) ;
void on_config_autostop_clicked ( ) ;
void on_config_autostop_clicked ( GtkCellRenderer * self , char * path , main_window * widgets ) ;
void on_config_block_clicked ( ) ;
void on_config_block_clicked ( GtkCellRenderer * self , char * path , main_window * widgets ) ;
void on_system_autostart_clicked ( ) ;
void on_system_autostart_clicked ( GtkCellRenderer * self , char * path , main_window * widgets ) ;
void on_system_kill_confirmed ( GtkWidget * self , char * service_name ) ;
void on_system_launch_clicked ( ) ;
void on_system_launch_clicked ( GtkWidget * self , char * path , main_window * widgets ) ;
void on_system_restart_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_source_show ( ) ;
void on_properties_show ( ) ;
void yon_sessions_update ( main_window * widgets ) ;
void on_session_activate ( ) ;
void on_session_end ( ) ;
void on_session_block ( ) ;
void yon_system_systemd_restart ( GtkWidget * self , main_window * widgets ) ;
void yon_user_systemd_restart ( GtkWidget * self , main_window * widgets ) ;
void on_system_update_hz_clicked ( GtkWidget * self , main_window * widgets ) ;
void yon_system_systemd_reexec ( GtkWidget * self , main_window * widgets ) ;
void on_system_update_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_system_info_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_system_log_clicked ( GtkWidget * self , main_window * widgets ) ;
void * on_terminal_relaunch ( log_window * window ) ;
void on_save_clicked ( GtkWidget * self , log_window * window ) ;
void on_update_clicked ( GtkWidget * self , log_window * window ) ;
void on_system_edit_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_filter_changed ( GtkWidget * self , main_window * widgets ) ;
void on_system_status_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_user_update_hz_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_user_update_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_user_info_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_user_log_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_user_edit_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_user_status_clicked ( GtkWidget * self , main_window * widgets ) ;
void on_config_log_save ( GtkWidget * self , log_window * window ) ;
void on_config_edit_clicked ( GtkWidget * self , main_window * widgets ) ;
gboolean yon_service_source_check ( GtkTreeModel * model , GtkTreeIter * iter , void * data ) ;
@ -268,6 +401,7 @@ gboolean on_source_user_filter(GtkTreeModel *model, GtkTreeIter *iter,void *data
gboolean on_source_system_filter ( GtkTreeModel * model , GtkTreeIter * iter , void * data ) ;
terminal_window * yon_terminal_window_new ( ) ;
void on_root_get_root ( char * argline ) ;
void on_root_access ( GtkWidget * self , main_window * widgets ) ;
void on_s ervice_update( GtkWidget * self , terminal_window * window ) ;
void on_s ave_done( main_window * widgets , config_str output , int size ) ;