diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 2d1be60..6469d42 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -57,6 +57,8 @@ add_custom_target( DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} ) +add_definitions(-DVTE_INCLUDE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ -O2 -pipe -fno-plt -fexceptions \ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ diff --git a/source/ubl-settings-services.c b/source/ubl-settings-services.c index d1aa9a5..c664547 100644 --- a/source/ubl-settings-services.c +++ b/source/ubl-settings-services.c @@ -36,6 +36,58 @@ void on_config_global_save(){ } + +static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data) +{ + if (error){}; + if (!terminal) return; + if (pid == -1) printf("Error\n\n\n"); + else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data)); +} + +void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument){ + char **commands=new_arr(char*,2); + gchar **envp = g_get_environ(); + commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL")); + commands[1]=NULL; + char **env=new_arr(char*,2); + env[0]=""; + env[1]=NULL; + vte_terminal_set_size(VTE_TERMINAL(terminal),10,15); + VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); + vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); + char *install_command=yon_char_unite("clear;tput cup 0 0 && tput ed; ",command," ; sleep 5; stty -echo; unset PS1","\n",NULL); + if(endwork_function) + g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); + vte_terminal_spawn_async(VTE_TERMINAL(terminal), + VTE_PTY_DEFAULT, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + child_ready, + install_command); + vte_pty_spawn_async(pty, + NULL, + commands, + NULL, + 0, + NULL, NULL, + NULL, + -1, + NULL, + NULL, + NULL); + vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), -1); + vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE); + vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE); + gtk_widget_show_all(terminal); + } + // standard functions void on_config_autostart_clicked(GtkWidget *self, main_window *widgets){ diff --git a/source/ubl-settings-services.h b/source/ubl-settings-services.h index c975f79..2500c9d 100644 --- a/source/ubl-settings-services.h +++ b/source/ubl-settings-services.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 6beb30c..1aef286 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -1,5 +1,5 @@ #define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL) -#define HELP_LABEL yon_char_unite(_("ubl-settings-services version:")," ", version_application,"\n",_("ubl-settings-services"),"\n",_("Usage:"), " ubl-settings-services ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n\t--clear-config\t\t\t",_("Reset application settings"),"\n",NULL) +#define HELP_LABEL yon_char_unite(_("ubl-settings-services version:")," ", version_application,"\n",TITLE_LABEL,"\n",_("Usage:"), " ubl-settings-services ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n\t--clear-config\t\t\t",_("Reset application settings"),"\n",NULL) #define TITLE_LABEL _("Services and processes systemd") #define TITLE_INFO_LABEL _("System services and processes configuration") @@ -12,4 +12,36 @@ #define SYSTEM_CONFIGURATION_LABEL _("Configure in system") #define LAUNCHED_LABEL _("Launched") #define SERVICE_RELOAD_LABEL _("Reload") -#define STATUS_LABEL _("Show status") \ No newline at end of file +#define STATUS_LABEL _("Show status") +#define UPDATE_LABEL _("Update") + +#define ALL_SERIVCES_LABEL _("All services") +#define SYSTEM_SERVICES_LABEL _("System services only") +#define USER_SERVICES_LABEL _("User services only") + +#define ALL_LABEL _("All") +#define SERVICES_LABEL _("Services") +#define SOCKETS_LABEL _("Sockets") +#define AUTOLAUNCH_CONFIG_LABEL _("Autolaunch in configuration") +#define STOPPED_CONFIG_LABEL _("Stopped in configuration") +#define BLOCKED_CONFIG_LABEL _("Blocked in configuration") + +#define AUTOSTART_TOGGLE_LABEL _("Toggle autostart at configuration") +#define AUTOSTOP_TOGGLE_LABEL _("Toggle autostop at configuration") +#define BLOCK_TOGGLE_LABEL _("Toggle service blocking at configuration") +#define SYSTEM_AUTOSTART_TOGGLE_LABEL _("Toggle autostart at system") +#define SYSTEM_LAUNCH_TOGGLE_LABEL _("Launch service") +#define CHECKSTATUS_LABEL _("Check service status") +#define LOG_LABEL _("Check service log") + +#define SERVICE_LABEL _("Service:") +#define DESCRIPTION_LABEL _("Description:") + +#define CONFIGURE_CONFIGURATION_LABEL _("Configure in configuration") +#define CONFIGURE_SYSTEM_LABEL _("Configure in system") +#define SERVICE_NAME_LABEL _("Service") + +#define AUTOSTART_LABEL _("Autostart") +#define AUTOSTOP_LABEL _("Autostop") +#define BLOCK_LABEL _("Block") +#define LAUNCHED_LABEL _("Launched") \ No newline at end of file diff --git a/ubl-settings-services-terminal.glade b/ubl-settings-services-terminal.glade index 9b04fcf..6b6b53b 100644 --- a/ubl-settings-services-terminal.glade +++ b/ubl-settings-services-terminal.glade @@ -39,6 +39,7 @@ True True True + Update image1