diff --git a/gresource.xml b/gresource.xml
index b9eb643..5ca4637 100644
--- a/gresource.xml
+++ b/gresource.xml
@@ -5,6 +5,7 @@
libublsettingsui-gtk3-about.glade
libublsettingsui-gtk3-documentation.glade
libublsettingsui-gtk3-saving.glade
+ libublsettingsui-gtk3-debugger.glade
libublsettingsui-gtk3.css
diff --git a/libublsettingsui-gtk3-debugger.glade b/libublsettingsui-gtk3-debugger.glade
new file mode 100644
index 0000000..3b458ab
--- /dev/null
+++ b/libublsettingsui-gtk3-debugger.glade
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ liststore1
+
+
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 6d9cd96..94043ac 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -9,6 +9,11 @@ include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GTK_LIBRARY_DIRS})
add_definitions(${GTK_CFLAGS_OTHER})
+pkg_check_modules(VTE291 REQUIRED vte-2.91)
+include_directories(${VTE291_INCLUDE_DIRS})
+link_directories(${VTE291_LIBRARY_DIRS})
+add_definitions(${VTE291_CFLAGS_OTHER})
+
find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0)
option(WEBKIT_FOUND "No" OFF)
@@ -31,6 +36,7 @@ set(DEPENDFILES
../libublsettingsui-gtk3-about.glade
../libublsettingsui-gtk3-documentation.glade
../libublsettingsui-gtk3-saving.glade
+ ../libublsettingsui-gtk3-debugger.glade
../gresource.xml
../libublsettingsui-gtk3-banner.png
../libublsettingsui-gtk3.css
@@ -73,11 +79,12 @@ add_library(${PROJECT_NAME} SHARED
set(LIBRARIES
${GTK_LIBRARIES}
${WEBKIT_LIBRARIES}
+ ${VTE291_LIBRARIES}
ublsettings
ublsettings-gtk3
pthread)
-add_definitions(-DVTE_DISABLE)
+add_definitions(-DVTE_INCLUDE)
message(${CMAKE_INSTALL_LIBDIR})
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR})
diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c
index 0917e6e..600c1a1 100644
--- a/source/libublsettingsui-gtk3.c
+++ b/source/libublsettingsui-gtk3.c
@@ -148,6 +148,23 @@ void on_save_window_parameter_switched(GtkCellRendererToggle *self, gchar *path,
}
+template_debug_window *template_debugger_window_new(){
+ template_debug_window *window = malloc(sizeof(template_debug_window));
+ GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_debug);
+ window->Window=yon_gtk_builder_get_widget(builder,"Window");
+ window->HeaderTopic=yon_gtk_builder_get_widget(builder,"HeaderTopic");
+ window->HeaderImage=yon_gtk_builder_get_widget(builder,"HeaderImage");
+ window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox");
+ window->Vte=yon_gtk_builder_get_widget(builder,"DebuggerTerminal");
+ gtk_window_set_title(GTK_WINDOW(window->Window),template_app_information.app_title);
+ gtk_label_set_text(GTK_LABEL(window->HeaderTopic),template_app_information.app_title);
+ gtk_window_set_icon_name(GTK_WINDOW(window->Window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
+ gtk_image_set_from_pixbuf(GTK_IMAGE(window->HeaderImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
+
+ yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"DebugWindow");
+ return window;
+}
+
void on_save_parameters(GtkWidget *self, template_saving_window *window){
char *append_command = yon_char_unite("ubconfig --target ",template_config->load_mode==1?"global":"system"," set ",NULL);
char *remove_command = yon_char_unite("ubconfig --target ",template_config->load_mode==1?"global":"system"," remove ",NULL);
@@ -169,26 +186,36 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){
}
} else { // non-empty new value - add
if (yon_dictionary_get(&final_append,section)){
- final_append->data=yon_char_unite((char*)final_append->data," ",yon_char_unite(parameter,"=\"",new_value,"\"",NULL),NULL);
+ final_append->data=yon_char_unite((char*)final_append->data," ",yon_char_unite(parameter,"=\'",new_value,"\'",NULL),NULL);
} else {
- yon_dictionary_add_or_create_if_exists_with_data(final_append,section, yon_char_unite(parameter,"=",new_value[0]!='\"'?"\"":"",new_value,new_value[strlen(new_value)-1]!='\"'?"\"":"",NULL));
+ yon_dictionary_add_or_create_if_exists_with_data(final_append,section, yon_char_unite(parameter,"=",new_value[0]!='\''?"\'":"",new_value,new_value[strlen(new_value)-1]!='\''?"\'":"",NULL));
}
}
}
}
}
+ if (debug_output==1){
+ template_debug_window *debug_window = template_debugger_window_new();
+ gtk_widget_show(debug_window->Window);
dictionary *dict = NULL;
+ char *final_command_line = "";
if (final_remove){
for_dictionaries(dict,final_remove){
char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL);
- system(final_command);
+ char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \'":"echo \'",final_command,"\';",final_command,NULL);
+ if (!yon_char_is_empty(final_command_line))
+ free(final_command_line);
+ final_command_line=temp;
free(final_command);
}
}
if (final_append){
for_dictionaries(dict,final_append){
char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL);
- system(final_command);
+ char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \'":"echo \'",final_command,"\';",final_command,NULL);
+ if (!yon_char_is_empty(final_command_line))
+ free(final_command_line);
+ final_command_line=temp;
free(final_command);
}
}
@@ -199,6 +226,34 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){
yon_config_save_registered("global");
}
}
+ if (!yon_char_is_empty(final_command_line)){
+ yon_terminal_integrated_start(debug_window->Vte,final_command_line,NULL,NULL);
+ }
+ } else {
+ dictionary *dict = NULL;
+ if (final_remove){
+ for_dictionaries(dict,final_remove){
+ char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL);
+ system(final_command);
+ free(final_command);
+ }
+ }
+ if (final_append){
+ for_dictionaries(dict,final_append){
+ char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL);
+ system(final_command);
+ free(final_command);
+ }
+ }
+ if (window->type==YON_CONFIG_BOTH) {
+ if (template_config->load_mode==1){
+ yon_config_save_registered("system");
+ } else if (template_config->load_mode==0){
+ yon_config_save_registered("global");
+ }
+ }
+
+ }
textdomain(template_ui_LocaleName);
if (window->type == YON_CONFIG_GLOBAL)
yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
@@ -625,12 +680,13 @@ int yon_ubl_setup_arguments(int argc, char *argv[],config_str *unfound_arguments
{"socket-id", 1, 0, 's'},
{"socket-ext-id", 1,0, 'e'},
{"socket-trd-id", 1,0, 't'},
- {"clear-config", 0,0, 'c'},
+ {"clear-config", 0,0, 'c'},
+ {"debug", 0,0, 'd'},
{ NULL, 0, NULL, 0 }
};
config_str unregistered_arguments=NULL;
for (int i=1;ilock_help=1;
break;
diff --git a/source/libublsettingsui-gtk3.h b/source/libublsettingsui-gtk3.h
index 86b8f45..3526e29 100644
--- a/source/libublsettingsui-gtk3.h
+++ b/source/libublsettingsui-gtk3.h
@@ -1,7 +1,10 @@
+#ifndef UBL_UTILS_UI
+#define UBL_UTILS_UI
#include
#include
#include
#include
+#include
#include
#include
#include
@@ -20,6 +23,7 @@
#define ui_glade_path_documentation "/com/ublinux/ui/libublsettingsui-gtk3-documentation.glade"
#define ui_glade_path_about "/com/ublinux/ui/libublsettingsui-gtk3-about.glade"
#define ui_glade_path_saving "/com/ublinux/ui/libublsettingsui-gtk3-saving.glade"
+#define ui_glade_path_debug "/com/ublinux/ui/libublsettingsui-gtk3-debugger.glade"
#define ui_banner_path "/com/ublinux/images/libublsettingsui-gtk3-banner.png"
#define ui_CssPath "/com/ublinux/css/libublsettingsui-gtk3.css"
#define ui_config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",template_app_information.app_tech_name,"/",template_app_information.app_tech_name,".conf",NULL)
@@ -197,12 +201,22 @@ typedef struct {
YON_CONFIG_TYPE type;
} template_saving_window;
+typedef struct {
+ GtkWidget *Window;
+ GtkWidget *HeaderTopic;
+ GtkWidget *HeaderImage;
+ GtkWidget *StatusBox;
+ GtkWidget *Vte;
+} template_debug_window;
+
typedef struct {
void (*function)(void*,void*);
void *data;
char *action_text;
} dialog_confirmation_data;
+static int debug_output;
+
int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data);
template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...);
@@ -271,4 +285,5 @@ void on_open_documentation_confirmation(GtkWidget *self, char *link);
*/
void on_subwindow_close(GtkWidget *self);
-int yon_ubl_setup_arguments(int argc, char *argv[],config_str *unfound_arguments, int *arguments_size, char *additional_options_output);
\ No newline at end of file
+int yon_ubl_setup_arguments(int argc, char *argv[],config_str *unfound_arguments, int *arguments_size, char *additional_options_output);
+#endif
\ No newline at end of file