From 5d6134abbd6405be2b55f1a1e104ae90a2e5c795 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 30 Jul 2024 15:26:27 +0600 Subject: [PATCH] Added check for autoscrolling; AUTOINSTALL[zone] test fix --- source/ubinstall-gtk.c | 13 +++++++++---- source/ubinstall-gtk.h | 2 ++ source/ubl-strings.h | 4 +++- ubinstall-gtk-log-view.glade | 3 ++- ubinstall-gtk.glade | 17 ++++++++++++++--- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 6310fef..205ef12 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -770,6 +770,7 @@ void config_init(){ main_config.configure_mode=0; main_config.load_mode=-1; main_config.log_progress_buzy=0; + main_config.log_end=0; } void on_configuration_mode_switch(GtkWidget *self); @@ -782,6 +783,8 @@ int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled int width = gtk_widget_get_allocated_width(gtk_widget_get_parent(gtk_widget_get_parent(GTK_WIDGET(target)))); int height = gtk_widget_get_allocated_height(gtk_widget_get_parent(gtk_widget_get_parent(GTK_WIDGET(target)))); + yon_debug_output("width: %s\n",yon_char_from_int(width)); + yon_debug_output("height: %s\n\n",yon_char_from_int(height)); int newImgWidthDef = (width <= 217) ? width : width - 30; int newImgHeightDef = (height <= 120) ? height : height - 217; GdkPixbuf *pixBuf = pixbuf_unscaled; @@ -1095,6 +1098,7 @@ log_window *yon_log_window_new(){ 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"); + window->ScrollToEndCheck = yon_gtk_builder_get_widget(builder,"ScrollToEndCheck"); g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_log_closed),window); gtk_widget_show(window->Window); return window; @@ -1111,12 +1115,11 @@ if (window->Window){ main_config.log_progress_buzy=0; if (size){ char *final = yon_char_parsed_to_string(parsed,size,""); - char *prev = (char*)gtk_label_get_text(GTK_LABEL(window->LogLabel)); + // char *prev = (char*)gtk_label_get_text(GTK_LABEL(window->LogLabel)); gtk_label_set_text(GTK_LABEL(window->LogLabel),final); - yon_debug_output("%s\n",yon_char_from_long((long)gtk_adjustment_get_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow))))); - yon_debug_output("%s\n",yon_char_from_long((long)gtk_adjustment_get_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow))))); - if (strcmp(final,prev)||gtk_adjustment_get_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))>gtk_adjustment_get_upper(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))-100) + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck))){ gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)),gtk_adjustment_get_upper(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(window->ScrollWindow)))); + } free(final); yon_char_parsed_free(parsed,size); } @@ -1243,6 +1246,8 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck))){ char *region = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo)); char *zone = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ZoneCombo)); + yon_debug_output("%s",region); + yon_debug_output("/%s\n\n",zone); yon_config_register(zone_parameter,zone_parameter_command,yon_char_unite(region,"/",zone,NULL)); } else { yon_config_remove_by_key(zone_parameter); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 133639c..9ae3adb 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -205,6 +205,7 @@ typedef struct { int log_progress_buzy; int autologin_default; int format_default; + int log_end; } config; typedef struct { @@ -428,6 +429,7 @@ typedef struct { GtkWidget *StatusBox; GtkWidget *HeadLabel; GtkWidget *LogLabel; + GtkWidget *ScrollToEndCheck; char *command; } log_window; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index a8c35ca..a3927ec 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -160,4 +160,6 @@ #define CONFIGURATION_FINISH_LABEL _("Choose a save option on the header bar") #define CONFIGURATION_SAVE_HEAD_LABEL _("Configuration has been saved") -#define CONFIGURATION_SAVE_LABEL _("You can safely exit configurator or return and create new configuration file.") \ No newline at end of file +#define CONFIGURATION_SAVE_LABEL _("You can safely exit configurator or return and create new configuration file.") + +#define SCROLL_TO_END_LABEL _("Scroll to the end") \ No newline at end of file diff --git a/ubinstall-gtk-log-view.glade b/ubinstall-gtk-log-view.glade index 72e47e5..6bd7dbc 100644 --- a/ubinstall-gtk-log-view.glade +++ b/ubinstall-gtk-log-view.glade @@ -1,5 +1,5 @@ - + @@ -47,6 +47,7 @@ True True False + True True diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index eb4c7d5..efdf931 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -1,5 +1,5 @@ - + @@ -1574,7 +1574,7 @@ and help you install UBLinux on your computer - False + True True 1 @@ -2311,9 +2311,20 @@ and help you install UBLinux on your computer - + True False + 0 + none + + + True + False + + + + + False