From 1e183a3ee2de4d1b09c3d974d8bb8a31fe7a09ba Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 16 Jul 2024 09:50:10 +0600 Subject: [PATCH 1/6] Added --debug and AUTOISNTALL[log]=yes to installation command --- source/ubinstall-gtk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index b9eb092..9839992 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -112,7 +112,7 @@ NULL #define part_type_parameter "AUTOINSTALL[part_fs_type]" #define part_type_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_fs_type]" -#define save_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters, "; nice ubinstall2 autoinstall'", NULL) +#define save_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall'", NULL) #define set_user_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters,";nice ubinstall2 autoconfig'",NULL) From bcba8c4da47437d5ba103a2f6c61c8bd6d60f770 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 16 Jul 2024 15:36:29 +0600 Subject: [PATCH 2/6] Added log view window --- gresource.xml | 1 + source/CMakeLists.txt | 1 + source/ubinstall-gtk.c | 55 ++++++++++++++++++ source/ubinstall-gtk.h | 15 +++++ ubinstall-gtk-log-view.glade | 110 +++++++++++++++++++++++++++++++++++ ubinstall-gtk.glade | 26 +++++++-- 6 files changed, 204 insertions(+), 4 deletions(-) create mode 100644 ubinstall-gtk-log-view.glade diff --git a/gresource.xml b/gresource.xml index 9844d18..fab2075 100644 --- a/gresource.xml +++ b/gresource.xml @@ -6,6 +6,7 @@ ubinstall-gtk-keyboard.glade ubinstall-gtk-about.glade ubinstall-gtk-documentation.glade + ubinstall-gtk-log-view.glade ubinstall-gtk.css diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index f4b0dd8..6442a1f 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -63,6 +63,7 @@ set(DEPENDFILES ../ubinstall-gtk-keyboard.glade ../ubinstall-gtk-about.glade ../ubinstall-gtk-documentation.glade + ../ubinstall-gtk-log-view.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index f34c5bf..e7caad8 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -516,6 +516,56 @@ void *on_setup_system_configuration(void * data){ return NULL; } +void on_log_closed(GtkWidget *, log_window *window); +void on_log_closed(GtkWidget *, log_window *window){ + free(window->command); + window->Window=NULL; +} + +log_window *yon_log_window_new(); +log_window *yon_log_window_new(){ + log_window *window = malloc(sizeof(log_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_log_view); + window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); + window->HeadLabel = yon_gtk_builder_get_widget(builder,"headerTopic"); + window->LogLabel = yon_gtk_builder_get_widget(builder,"LogLabel"); + window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),window); + return window; +} + +gboolean yon_read_log(void *data); +gboolean yon_read_log(void *data){ +log_window *window = (log_window*)data; +if (window->Window){ + int size; + config_str parsed = yon_config_load(window->command,&size); + if (size){ + char *final = yon_char_parsed_to_string(parsed,size,""); + gtk_label_set_text(GTK_LABEL(window->LogLabel),final); + free(final); + yon_char_parsed_free(parsed,size); + } + return 1; +} +return 0; +} + +void on_process_log_view(); +void on_process_log_view(){ + log_window *window = yon_log_window_new(); + window->command = yon_char_new(short_log_path); + gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); +} + +void on_summary_log_view(); +void on_summary_log_view(){ + log_window *window = yon_log_window_new(); + window->command = yon_char_new(full_log_path); + gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); + +} + void yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree,char *mode,main_window *widgets); void yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree,char *mode,main_window *widgets){ GtkTreeIter iter,itar; @@ -1278,8 +1328,10 @@ main_window *yon_main_window_complete(){ widgets->InstallationProgress = yon_gtk_builder_get_widget(builder,"InstallationProgress"); widgets->InstallationLabel = yon_gtk_builder_get_widget(builder,"InstallationLabel"); + widgets->ReadShortLogButton = yon_gtk_builder_get_widget(builder,"ReadShortLogButton"); widgets->PackageInstallationProgress = yon_gtk_builder_get_widget(builder,"PackageInstallationProgress"); widgets->PackageInstallationLabel = yon_gtk_builder_get_widget(builder,"PackageInstallationLabel"); + widgets->ReadFullLogButton = yon_gtk_builder_get_widget(builder,"ReadFullLogButton"); widgets->SameInstallationFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"SameInstallationFilesystemTypeCombo"); widgets->SameInstallationFormatCheck = yon_gtk_builder_get_widget(builder,"SameInstallationFormatCheck"); @@ -1335,6 +1387,9 @@ main_window *yon_main_window_complete(){ widgets->AdditionalSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AdditionalSoftwareList")); widgets->PartitionsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PartitionsList")); + g_signal_connect(G_OBJECT(widgets->ReadFullLogButton),"clicked",G_CALLBACK(on_summary_log_view),NULL); + g_signal_connect(G_OBJECT(widgets->ReadShortLogButton),"clicked",G_CALLBACK(on_process_log_view),NULL); + g_signal_connect(G_OBJECT(widgets->GpartedCommonButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedSameButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedNearButton),"clicked",G_CALLBACK(on_gparted_open),NULL); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 9839992..4eff327 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -23,6 +23,7 @@ #define glade_path "/com/ublinux/ui/ubinstall-gtk.glade" #define glade_path_ubinstall_keyboard "/com/ublinux/ui/ubinstall-gtk-keyboard.glade" #define glade_path_ubinstall_language "/com/ublinux/ui/ubinstall-gtk-language.glade" +#define glade_path_log_view "/com/ublinux/ui/ubinstall-gtk-log-view.glade" #define ui_glade_path_about "/com/ublinux/ui/ubinstall-gtk-about.glade" #define ui_glade_path_documentation "/com/ublinux/ui/ubinstall-gtk-documentation.glade" @@ -130,6 +131,10 @@ NULL #define password_limits_path "/etc/security/pwquiality.conf" +#define short_log_path "/var/log/ubinstall_progress.log" + +#define full_log_path "/var/log/ubinstall.log" + typedef char* string; string version_application; @@ -271,8 +276,10 @@ typedef struct { GtkWidget *InstallationProgress; GtkWidget *InstallationLabel; + GtkWidget *ReadShortLogButton; GtkWidget *PackageInstallationProgress; GtkWidget *PackageInstallationLabel; + GtkWidget *ReadFullLogButton; GtkWidget *GpartedCommonButton; GtkWidget *GpartedNearButton; @@ -370,6 +377,14 @@ typedef struct{ GtkWidget *NoEncriptionCheck; } password_window; +typedef struct { + GtkWidget *Window; + GtkWidget *StatusBox; + GtkWidget *HeadLabel; + GtkWidget *LogLabel; + char *command; +} log_window; + void config_init(); main_window *yon_main_window_complete(); ubinstall_language_window *yon_ubinstall_language_new(); diff --git a/ubinstall-gtk-log-view.glade b/ubinstall-gtk-log-view.glade new file mode 100644 index 0000000..a09a1e4 --- /dev/null +++ b/ubinstall-gtk-log-view.glade @@ -0,0 +1,110 @@ + + + + + + + 200 + 400 + False + True + 800 + com.ublinux.ubinstall-gtk + + + True + False + vertical + 5 + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + vertical + 5 + + + True + True + in + + + True + False + + + True + False + label + 0 + 0 + + + + + + + True + True + 1 + + + + + True + True + 1 + + + + + + + True + False + True + + + True + False + Keyboard layout language + + + + + + + + True + False + 32 + com.ublinux.ubinstall-gtk + + + + + + + diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 19ad7ab..e70d5dd 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -107,6 +107,16 @@ False com.ublinux.libublsettingsui-gtk3.trash-symbolic + + True + False + com.ublinux.ubinstall.properties-symbolic + + + True + False + com.ublinux.ubinstall.properties-symbolic + True False @@ -6844,10 +6854,14 @@ separately into the selected partition. - - button + + True True True + image16 + False @@ -6903,10 +6917,14 @@ separately into the selected partition. - - button + + True True True + image15 + False From 9b41f754383c13db6ad25f82f2400e80b2cacd3d Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 16 Jul 2024 15:42:04 +0600 Subject: [PATCH 3/6] Fixed invisible window --- source/ubinstall-gtk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index e7caad8..497fc01 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -531,6 +531,7 @@ log_window *yon_log_window_new(){ window->LogLabel = yon_gtk_builder_get_widget(builder,"LogLabel"); window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),window); + gtk_widget_show(window->Window); return window; } From 402c7148f0417427e968e224e118a8b12288e602 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 16 Jul 2024 16:18:49 +0600 Subject: [PATCH 4/6] switched log reading command --- source/ubinstall-gtk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 497fc01..e41cb78 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -540,7 +540,7 @@ gboolean yon_read_log(void *data){ log_window *window = (log_window*)data; if (window->Window){ int size; - config_str parsed = yon_config_load(window->command,&size); + config_str parsed = yon_file_open(window->command,&size); if (size){ char *final = yon_char_parsed_to_string(parsed,size,""); gtk_label_set_text(GTK_LABEL(window->LogLabel),final); From 5dcc2abe83a8650733e693a57838cb92c0559a95 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 16 Jul 2024 16:50:44 +0600 Subject: [PATCH 5/6] Removed text from second progress bar after installation completion --- source/ubinstall-gtk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index e41cb78..9d056e3 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -395,7 +395,10 @@ gboolean yon_installation_progress_update(void *data){ if (main_config.install_thread){ return 1; - } else return 0; + } else { + gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel),""); + return 0; + } } void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets); From 5797b97fca62ab5dd67ef2242cdc99cec49b5360 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 16 Jul 2024 16:58:25 +0600 Subject: [PATCH 6/6] fixed window transistance, removed log label statrup text, changed log window title --- source/ubinstall-gtk.c | 14 ++++++++------ source/ubl-strings.h | 2 ++ ubinstall-gtk-log-view.glade | 3 +-- ubinstall-gtk.pot | 4 ++++ ubinstall-gtk_ru.po | 4 ++++ 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 9d056e3..51f324d 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -555,16 +555,18 @@ if (window->Window){ return 0; } -void on_process_log_view(); -void on_process_log_view(){ +void on_process_log_view(GtkWidget *,main_window *widgets); +void on_process_log_view(GtkWidget *,main_window *widgets){ log_window *window = yon_log_window_new(); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),LOG_VIEW_LABEL,icon_path,"log_viewer"); window->command = yon_char_new(short_log_path); gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); } -void on_summary_log_view(); -void on_summary_log_view(){ +void on_summary_log_view(GtkWidget *,main_window *widgets); +void on_summary_log_view(GtkWidget *,main_window *widgets){ log_window *window = yon_log_window_new(); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),LOG_VIEW_LABEL,icon_path,"log_viewer"); window->command = yon_char_new(full_log_path); gdk_threads_add_timeout(500,(GSourceFunc)yon_read_log,window); @@ -1391,8 +1393,8 @@ main_window *yon_main_window_complete(){ widgets->AdditionalSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AdditionalSoftwareList")); widgets->PartitionsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PartitionsList")); - g_signal_connect(G_OBJECT(widgets->ReadFullLogButton),"clicked",G_CALLBACK(on_summary_log_view),NULL); - g_signal_connect(G_OBJECT(widgets->ReadShortLogButton),"clicked",G_CALLBACK(on_process_log_view),NULL); + g_signal_connect(G_OBJECT(widgets->ReadFullLogButton),"clicked",G_CALLBACK(on_summary_log_view),widgets); + g_signal_connect(G_OBJECT(widgets->ReadShortLogButton),"clicked",G_CALLBACK(on_process_log_view),widgets); g_signal_connect(G_OBJECT(widgets->GpartedCommonButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedSameButton),"clicked",G_CALLBACK(on_gparted_open),NULL); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 1f272cd..acf0d95 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -136,3 +136,5 @@ #define CONFIGURATION_MODE_LABEL _("Configuration mode") #define ERROR_HEAD_LABEL _("Error") #define ERROR_LABEL _("Error has occured while installation process") + +#define LOG_VIEW_LABEL _("Log exploration") \ No newline at end of file diff --git a/ubinstall-gtk-log-view.glade b/ubinstall-gtk-log-view.glade index a09a1e4..3ae0a8e 100644 --- a/ubinstall-gtk-log-view.glade +++ b/ubinstall-gtk-log-view.glade @@ -55,7 +55,6 @@ True False - label 0 0 @@ -87,7 +86,7 @@ True False - Keyboard layout language + Log exploration diff --git a/ubinstall-gtk.pot b/ubinstall-gtk.pot index ef919bb..23a2639 100644 --- a/ubinstall-gtk.pot +++ b/ubinstall-gtk.pot @@ -486,6 +486,10 @@ msgstr "" msgid "Configuration mode" msgstr "" +#: source/ubl-strings.h:140 +msgid "Log exploration" +msgstr "" + msgid "Afrikaans" msgstr "" diff --git a/ubinstall-gtk_ru.po b/ubinstall-gtk_ru.po index d3fbdff..168de28 100644 --- a/ubinstall-gtk_ru.po +++ b/ubinstall-gtk_ru.po @@ -508,6 +508,10 @@ msgstr "Во время процесса установки произошла msgid "Configuration mode" msgstr "Режим конфигурации" +#: source/ubl-strings.h:140 +msgid "Log exploration" +msgstr "Просмотр лога" + msgid "Afrikaans" msgstr "Африканский"