|
|
|
|
@ -180,14 +180,14 @@ void on_setup_command(GtkWidget *self, main_window *widgets){
|
|
|
|
|
int su_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserSuCheck));
|
|
|
|
|
int sudo_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserSudoCheck));
|
|
|
|
|
int priority_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->priorityCheck));
|
|
|
|
|
char *priority = priority_check ? yon_char_append(" -p ",yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->prioritySpin)))) : "";
|
|
|
|
|
char *priority = priority_check ? yon_char_append(" --priority=",yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->prioritySpin)))) : "";
|
|
|
|
|
int size;
|
|
|
|
|
char *command = yon_char_unite(get_run_command_command,
|
|
|
|
|
terminal_check ? yon_char_append(" -t ", terminal->name_simple) : "",
|
|
|
|
|
user_check ? yon_char_append(" -u ", user) : "",
|
|
|
|
|
user_check&&pkexec_check ? " -e pkexec" : "",
|
|
|
|
|
user_check&&su_check ? " -e su" : "",
|
|
|
|
|
user_check&&sudo_check ? " -e sudo" : "",
|
|
|
|
|
char *command = yon_char_unite(get_run_command_command, " -o",
|
|
|
|
|
terminal_check ? yon_char_append(" --terminal=", terminal->name_simple) : "",
|
|
|
|
|
user_check ? yon_char_append(" --user=", user) : "",
|
|
|
|
|
user_check&&pkexec_check ? " --exec=pkexec" : "",
|
|
|
|
|
user_check&&su_check ? " --exec=su" : "",
|
|
|
|
|
user_check&&sudo_check ? " --exec=sudo" : "",
|
|
|
|
|
priority_check ? priority : "",
|
|
|
|
|
yon_char_append(" ",target),
|
|
|
|
|
NULL);
|
|
|
|
|
@ -199,8 +199,38 @@ void on_setup_command(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_command_run(GtkWidget *self, main_window *widgets){
|
|
|
|
|
if (strcmp(gtk_entry_get_text(GTK_ENTRY(widgets->commandEntry)),"")){
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->commandCheck))){
|
|
|
|
|
const char *command = gtk_entry_get_text(GTK_ENTRY(widgets->commandEntry));
|
|
|
|
|
yon_launch_thread((char*)command);
|
|
|
|
|
} else {
|
|
|
|
|
char *target = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->TargetNameEntry));
|
|
|
|
|
if (target&&strcmp(target,"")){
|
|
|
|
|
char *final_command;
|
|
|
|
|
int terminal_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithTerminalCheck));
|
|
|
|
|
int chosen_terminal = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->runWithTerminalCombo));
|
|
|
|
|
terminal_info *terminal = yon_dictionary_get_data(yon_dictionary_get_nth(main_config.terminals,chosen_terminal),terminal_info*);
|
|
|
|
|
int user_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserCheck));
|
|
|
|
|
char *user = (char*)gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->runWithUserCombo));
|
|
|
|
|
int pkexec_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserPkexecCheck));
|
|
|
|
|
int su_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserSuCheck));
|
|
|
|
|
int sudo_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserSudoCheck));
|
|
|
|
|
int priority_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->priorityCheck));
|
|
|
|
|
char *priority = priority_check ? yon_char_append(" --priority=",yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->prioritySpin)))) : "";
|
|
|
|
|
int size;
|
|
|
|
|
char *command = yon_char_unite(get_run_command_command,
|
|
|
|
|
terminal_check ? yon_char_append(" --terminal=", terminal->name_simple) : "",
|
|
|
|
|
user_check ? yon_char_append(" --user=", user) : "",
|
|
|
|
|
user_check&&pkexec_check ? " --exec=pkexec" : "",
|
|
|
|
|
user_check&&su_check ? " --exec=su" : "",
|
|
|
|
|
user_check&&sudo_check ? " --exec=sudo" : "",
|
|
|
|
|
priority_check ? priority : "",
|
|
|
|
|
yon_char_append(" ",target),
|
|
|
|
|
NULL);
|
|
|
|
|
yon_launch(command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard functions
|
|
|
|
|
|