Added check for stopping service in system

pull/12/head
parent b5b47b3112
commit bb38f103c0

@ -229,9 +229,22 @@ void on_system_launch_clicked(GtkWidget *self, main_window *widgets){
gboolean status = 0;
char *service_name;
gtk_tree_model_get(model,&iter,4,&status,5,&service_name,-1);
gtk_list_store_set(GTK_LIST_STORE(widgets->liststore2),&iter,4,!status,-1);
yon_launch((!status)==1 ? service_start_command(service_name) : \
service_stop_command(service_name));
int size;
config_str result = yon_config_load(service_check_active_command(service_name),&size);
yon_char_remove_last_symbol(result[0],'\n');
if (size>0){
if (!strcmp(result[0],"active")){
gtk_list_store_set(GTK_LIST_STORE(widgets->liststore2),&iter,4,1,-1);
if (status){
yon_ubl_status_box_render(SWITCH_OFF_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
}
} else {
gtk_list_store_set(GTK_LIST_STORE(widgets->liststore2),&iter,4,0,-1);
}
}
yon_char_parsed_free(result,size);
}
}

@ -42,6 +42,7 @@
#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_check_active_command(target) yon_char_append("systemctl is-active ",target)
typedef char* string;
string version_application;

@ -46,4 +46,6 @@
#define BLOCK_LABEL _("Block")
#define LAUNCHED_LABEL _("Launched")
#define LIST_LOAD_LABEL _("Service list is loading")
#define STATUS_LABEL _("Status")
#define STATUS_LABEL _("Status")
#define SWITCH_OFF_ERROR_LABEL _("Service were not stopped")

@ -200,3 +200,7 @@ msgstr ""
#: source/ubl-strings.h:49
msgid "Status"
msgstr ""
#: source/ubl-strings.h:51
msgid "Service were not stopped"
msgstr ""

@ -201,3 +201,7 @@ msgstr "Список сервисов загружается"
#: source/ubl-strings.h:49
msgid "Status"
msgstr "Статус"
#: source/ubl-strings.h:51
msgid "Service were not stopped"
msgstr "Сервис не был остановлен"

Loading…
Cancel
Save