Confirmation dialog for unstoppable services

pull/12/head
parent 17e0d49d22
commit 6be744e3e0

@ -221,6 +221,12 @@ void on_system_autostart_clicked(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);
}
void on_system_launch_clicked(GtkWidget *self, main_window *widgets){
if (self){};
GtkTreeIter iter;
@ -236,9 +242,16 @@ void on_system_launch_clicked(GtkWidget *self, main_window *widgets){
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);
dialog_confirmation_data data;
data.action_text=STOP_SERVICE_WARMING_LABEL(service_name);
data.function=(void*)(void*)on_system_kill_confirmed;
data.data=service_name;
int answer = yon_confirmation_dialog_call(self,&data);
if (answer)
gtk_list_store_set(GTK_LIST_STORE(widgets->liststore2),&iter,4,0,-1);
} else {
gtk_list_store_set(GTK_LIST_STORE(widgets->liststore2),&iter,4,1,-1);
}
} else {
gtk_list_store_set(GTK_LIST_STORE(widgets->liststore2),&iter,4,0,-1);

@ -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_kill_command(target) yon_char_append("systemctl kill ",target)
#define service_check_active_command(target) yon_char_append("systemctl is-active ",target)
typedef char* string;
@ -208,6 +209,8 @@ void on_config_block_clicked();
void on_system_autostart_clicked();
void on_system_kill_confirmed(GtkWidget *self,char *service_name);
void on_system_launch_clicked();
gboolean yon_service_source_check(GtkTreeModel *model, GtkTreeIter *iter, void *data);

@ -48,4 +48,5 @@
#define LIST_LOAD_LABEL _("Service list is loading")
#define STATUS_LABEL _("Status")
#define SWITCH_OFF_ERROR_LABEL _("Service were not stopped")
#define SWITCH_OFF_ERROR_LABEL _("Service were not stopped")
#define STOP_SERVICE_WARMING_LABEL(target) yon_char_unite(_("Are you sure want to stop "),target,"? ",_("The stop will be forced.\nThe system may become unstable."),NULL)

@ -204,3 +204,13 @@ msgstr ""
#: source/ubl-strings.h:51
msgid "Service were not stopped"
msgstr ""
#: source/ubl-strings.h:52
msgid "Are you sure want to stop "
msgstr ""
#: source/ubl-strings.h:52
msgid ""
"The stop will be forced.\n"
"The system may become unstable."
msgstr ""

@ -205,3 +205,14 @@ msgstr "Статус"
#: source/ubl-strings.h:51
msgid "Service were not stopped"
msgstr "Сервис не был остановлен"
#: source/ubl-strings.h:52
msgid "Are you sure want to stop "
msgstr "Вы уверены что хотите остановить "
#: source/ubl-strings.h:52
msgid ""
"The stop will be forced.\n"
"The system may become unstable."
msgstr "Остановка будет произведена принудительно.\n"
"Возможна нестабильная работа системы."

Loading…
Cancel
Save