diff --git a/source/ubl-settings-services.c b/source/ubl-settings-services.c index dc93d96..62843f5 100644 --- a/source/ubl-settings-services.c +++ b/source/ubl-settings-services.c @@ -117,7 +117,7 @@ void on_config_global_save(){ void on_config_custom_save(GtkWidget *self, main_window *widgets){ if (self&&widgets){} main_config.save_config=1; - template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_CUSTOM,config_get_command("system"),NULL); + template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_CUSTOM,yon_config_get_custom_command("system"),NULL); if (window){}; } @@ -339,6 +339,11 @@ void on_config_block_clicked(GtkCellRenderer *self, char *path, main_window *wid } +void on_system_autostart_confirmed(GtkWidget *self,char *service_command){ + if (self){}; + yon_launch_app_with_arguments(service_command,""); +} + void on_system_autostart_clicked(GtkCellRenderer *self, char *path, main_window *widgets){ if (self){}; GtkTreeIter filter_iter; @@ -359,9 +364,15 @@ void on_system_autostart_clicked(GtkCellRenderer *self, char *path, main_window gboolean status = 0; char *service_name; gtk_tree_model_get(model,&iter,3,&status,5,&service_name,-1); + dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data)); + data->action_text=(!status)==0 ?SERVICE_DISABLE_WARNING_LABEL(service_name):SERVICE_ENABLE_WARNING_LABEL(service_name); + data->data=(!status)==1 ? service_enable_command(service_name) : \ + service_disable_command(service_name); + data->function=(void*)(void*)on_system_autostart_confirmed; + int responce = yon_confirmation_dialog_call(widgets->Window,data); + if (responce == GTK_RESPONSE_ACCEPT){ gtk_list_store_set(GTK_LIST_STORE(model),&iter,3,!status,-1); - yon_launch((!status)==1 ? service_enable_command(service_name) : \ - service_disable_command(service_name)); + } } } @@ -441,7 +452,7 @@ void on_filter_changed(GtkWidget *self, main_window *widgets){ void on_system_kill_confirmed(GtkWidget *self,char *service_name){ if (self){}; char *command = service_kill_command(service_name); - yon_launch(command); + yon_launch_app_with_arguments(command,""); } void on_system_launch_clicked(GtkWidget *self, char *path, main_window *widgets){ @@ -494,8 +505,36 @@ void on_system_launch_clicked(GtkWidget *self, char *path, main_window *widgets) } +void on_service_restart_confirmed(GtkWidget *self,char *service_name){ + if (self){}; + char *command = restart_command(service_name); + yon_launch_app_with_arguments(command,""); +} + void on_system_restart_clicked(GtkWidget *self, main_window *widgets){ if (self&&widgets){}; + GtkWidget *target_tree; + switch(gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))){ + case 0:target_tree=widgets->SystemUnitsTree; + break; + case 1: target_tree = widgets->UserUnitsTree; + break; + default: return; + } + GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(target_tree)); + GtkTreeIter iter; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(target_tree)),&model,&iter)){ + char *target; + gtk_tree_model_get(model,&iter,5,&target,-1); + dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data)); + data->action_text=REEXEC_SERVICE_WARMING_LABEL(target); + data->data=target; + data->function=(void*)(void*)on_service_restart_confirmed; + int responce = yon_confirmation_dialog_call(widgets->Window,data); + if (responce == GTK_RESPONSE_ACCEPT){ + yon_ubl_status_box_render(SERVICE_RELOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); + } + } } void yon_sessions_update(main_window *widgets){ @@ -1430,6 +1469,7 @@ void yon_main_window_complete(main_window *widgets){ widgets->UserSystemLaunchedCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"UserSystemLaunchedCell")); widgets->SystemMenu = yon_rmb_menu_setup(widgets->SystemUnitsTree,NULL,NULL, RESTART_LABEL,update_icon_path,G_CALLBACK(on_system_restart_clicked),widgets, + RELAUNCH_SYSTEMCTL_LABEL,relaunch_icon_path,G_CALLBACK(yon_system_systemd_restart),widgets, STATUS_LABEL,status_icon_path,on_system_info_clicked,widgets, SHOW_LOG_LABEL,log_icon_path,on_system_log_clicked,widgets, SHOW_SOURCE_LABEL,source_icon_path,on_system_edit_clicked,widgets, @@ -1452,6 +1492,7 @@ void yon_main_window_complete(main_window *widgets){ widgets->UserDescriptionLabel=yon_gtk_builder_get_widget(builder,"UserDescriptionLabel"); widgets->UserMenu = yon_rmb_menu_setup(widgets->UserUnitsTree,NULL,NULL, RESTART_LABEL,update_icon_path,G_CALLBACK(on_system_restart_clicked),widgets, + RELAUNCH_SYSTEMCTL_LABEL,relaunch_icon_path,G_CALLBACK(yon_system_systemd_restart),widgets, STATUS_LABEL,status_icon_path,on_user_info_clicked,widgets, SHOW_LOG_LABEL,log_icon_path,on_user_log_clicked,widgets, SHOW_SOURCE_LABEL,source_icon_path,on_user_edit_clicked,widgets, @@ -1473,11 +1514,13 @@ void yon_main_window_complete(main_window *widgets){ { GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->SystemMenu->menu)); gtk_style_context_add_class(gtk_widget_get_style_context(g_list_nth_data(list,1)),"separatorTop"); + gtk_style_context_add_class(gtk_widget_get_style_context(g_list_nth_data(list,1)),"separatorBottom"); g_list_free(list); } { GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->UserMenu->menu)); gtk_style_context_add_class(gtk_widget_get_style_context(g_list_nth_data(list,1)),"separatorTop"); + gtk_style_context_add_class(gtk_widget_get_style_context(g_list_nth_data(list,1)),"separatorBottom"); g_list_free(list); } widgets->SystemServiceLabel=yon_gtk_builder_get_widget(builder,"SystemServiceLabel"); diff --git a/source/ubl-settings-services.h b/source/ubl-settings-services.h index b49aa1a..8fb44ab 100644 --- a/source/ubl-settings-services.h +++ b/source/ubl-settings-services.h @@ -101,6 +101,9 @@ #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 relaunch_icon_path "com.ublinux.ubl-settings-services.sync-time-symbolic" + +#define restart_command(target) yon_char_append("systemctl restart ",target) #define reload_systemd_root_command "systemctl daemon-reload" #define reexec_systemd_root_command "systemctl daemon-reexec" @@ -325,6 +328,12 @@ void on_source_show(); void on_properties_show(); +void on_system_autostart_confirmed(GtkWidget *self,char *service_command); + +void on_service_restart_confirmed(GtkWidget *self,char *service_name); + +void on_system_system_restart_clicked(GtkWidget *self, main_window *widgets); + void yon_sessions_update(main_window *widgets); void on_session_activate(); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index f394e9b..62bc354 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -16,6 +16,8 @@ #define SYSTEM_SERVICES_LABEL _("System services only") #define USER_SERVICES_LABEL _("User services only") +#define SAVE_PROCESS_LABEL _("Saving...") + #define ALL_LABEL _("All") #define SERVICES_LABEL _("Services") #define SOCKETS_LABEL _("Sockets") @@ -44,7 +46,7 @@ #define LAUNCHED_LABEL _("Launched") #define LIST_LOAD_LABEL _("Service list is loading") #define STATUS_LABEL _("Status") -#define RESTART_LABEL _("Restart with new configuration") +#define RESTART_LABEL _("Restart") #define SHOW_LOG_LABEL _("Show log") #define SHOW_SOURCE_LABEL _("Show source") #define PROPERTIES_LABEL _("Properties") @@ -61,8 +63,11 @@ #define SWITCH_OFF_ERROR_LABEL _("Service were not stopped") #define SERVICE_STOP_WARNING_LABEL(target) yon_char_unite(_("Are you sure want to stop "),target,"?\n",_("The system may become unstable."),NULL) +#define SERVICE_SART_WARNING_LABEL(target) yon_char_unite(_("Are you sure want to start "),target,"?\n",_("The system may become unstable."),NULL) #define REEXEC_SERVICE_WARMING_LABEL(target) yon_char_unite(_("Are you sure want to restart "),target,"?\n",_("The system may become unstable."),NULL) #define RELOAD_SERVICE_WARMING_LABEL(target) yon_char_unite(_("Are you sure want to reload "),target,"?\n",_("The system may become unstable."),NULL) +#define SERVICE_ENABLE_WARNING_LABEL(target) yon_char_unite(_("Are you sure want to enable "),target,"?\n",_("The system may become unstable."),NULL) +#define SERVICE_DISABLE_WARNING_LABEL(target) yon_char_unite(_("Are you sure want to disable "),target,"?\n",_("The system may become unstable."),NULL) #define DAYS_LABEL _("Days") #define HOURS_LABEL _("Hours") #define MINUTES_LABEL _("Minutes") @@ -86,8 +91,8 @@ #define UNIT_LABEL _("Unit") -#define RELAUNCH_SYSTEMCTL_LABEL _("Relaunch systemctl") -#define REEXEC_SYSTEMCTL_LABEL _("Reexec systemctl") +#define RELAUNCH_SYSTEMCTL_LABEL _("Relaunch with new configuration") +#define REEXEC_SYSTEMCTL_LABEL _("Reexec systemd") #define SHOW_SERVICE_INFO_LABEL _("Show service information") #define SHOW_SERVICE_LOG_LABEL _("Show service log") #define SHOW_SERVICE_SOURCE_LABEL _("Show service source file") @@ -140,4 +145,6 @@ #define SYSTEMD_REEXEC_SUCCESS_LABEL _("Systemd has been re-executed") #define SYSTEMD_RELAUNCH_SUCCESS_LABEL _("Systemd has been relaunched") +#define SERVICE_RELOAD_SUCCESS_LABEL _("Service has been successfully restarted") + #define SAVE_LABEL _("Save") \ No newline at end of file diff --git a/systemd_conf.csv b/systemd_conf.csv new file mode 100644 index 0000000..66b8146 --- /dev/null +++ b/systemd_conf.csv @@ -0,0 +1,17 @@ +config_name;description +ubconfig*.conf;UBLinux OS configuration files +coredump*.conf;System Debug Dump Configuration +journald*.conf;Configuring various systemd log service options +journal-upload*.conf;Configuring various systemd-journal-upload.service parameters +networkd*.conf;Configuring Global Network Settings +pstore*.conf;Configuration file for systemd-pstore, a tool for archiving the contents of the pstore persistent storage file system +sleep*.conf;Workstation hibernation options +system*.conf;Systemd configuration +user*.conf;User Configuration +homed*.conf;Settings management configuration for user account home directories created and managed by systemd-homed.service +journal-remote*.conf;Configuration files for various systemd-journal-remote.service parameters +logind*.conf;Configuration files for various systemd login manager options +oomd*.conf;Configuration files for various out-of-memory (OOM) killer parameters in systemd user space +resolved*.conf;Local DNS and LLMNR name resolution management configuration files +swap*.conf;System swap file management configuration files +timesyncd*.conf;Configuration file controlling NTP network time synchronization \ No newline at end of file diff --git a/ubl-settings-services.glade b/ubl-settings-services.glade index 0726e48..1b5f3a0 100644 --- a/ubl-settings-services.glade +++ b/ubl-settings-services.glade @@ -387,7 +387,7 @@ True True True - Relaunch systemctl + Relaunch with new cnfiguration image1