diff --git a/source/ubinstall-gtk-configuration-mode.c b/source/ubinstall-gtk-configuration-mode.c index 85aba75..7fc9e84 100644 --- a/source/ubinstall-gtk-configuration-mode.c +++ b/source/ubinstall-gtk-configuration-mode.c @@ -47,8 +47,12 @@ void configuration_mode_accept(GtkWidget *,configuration_window *window){ yon_ubl_status_highlight_incorrect(window->PathEntry); return; } + main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets"); if (yon_configuration_path_check(path)){ gtk_widget_destroy(window->Window); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ConfigurationModeCheck),1); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ConfigurationModeCheck),0); } } @@ -64,25 +68,15 @@ void on_path_choose(GtkWidget *,configuration_window *window){ void on_configuration_exit(GtkWidget *,configuration_window *window){ main_window *widgets = g_object_get_data(G_OBJECT(window->Window),"widgets"); - GList *box = gtk_container_get_children(GTK_CONTAINER(widgets->ConfigurationModeMenuItem)); - GList *children = gtk_container_get_children(GTK_CONTAINER(box->data)); - GtkWidget *Check = GTK_WIDGET(g_list_nth_data(children,1)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Check),0); - g_list_free(box); - g_list_free(children); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->ConfigurationModeCheck),0); gtk_widget_destroy(window->Window); if (getuid()){ gtk_main_quit(); } } -void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ - - GList *box = gtk_container_get_children(GTK_CONTAINER(self)); - GList *children = gtk_container_get_children(GTK_CONTAINER(box->data)); - - GtkWidget *Check = GTK_WIDGET(g_list_nth_data(children,0)); - int active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Check)); +void on_configuration_mode_switch(GtkWidget *,main_window *widgets){ + int active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ConfigurationModeCheck)); if (!active){ GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_configuration_mode); configuration_window *window = malloc(sizeof(configuration_window)); @@ -96,6 +90,7 @@ void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_configuration_exit),window); g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(gtk_main_quit),NULL); g_signal_connect(G_OBJECT(window->ChooseButton),"clicked",G_CALLBACK(configuration_mode_accept),window); + g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); g_signal_connect(G_OBJECT(window->PathButton),"clicked",G_CALLBACK(on_path_choose),window); g_object_set_data(G_OBJECT(window->Window),"widgets",widgets); yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),CONFIGURATION_MODE_TITLE_LABEL,icon_path,"configuration_window"); @@ -131,8 +126,4 @@ void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ main_config.configure_mode = 0; } - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Check),!active); - g_list_free(box); - g_list_free(children); - } diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 803e10e..d731b25 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -856,8 +856,8 @@ void yon_main_window_create(main_window *widgets){ widgets->ConfigurationModeMenuItem = gtk_menu_item_new(); GtkWidget *Box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); GtkWidget *Label = gtk_label_new(CONFIGURATION_MODE_LABEL); - GtkWidget *Check = gtk_check_button_new(); - gtk_box_pack_start(GTK_BOX(Box),Check,0,0,0); + widgets->ConfigurationModeCheck = gtk_check_button_new(); + gtk_box_pack_start(GTK_BOX(Box),widgets->ConfigurationModeCheck,0,0,0); gtk_box_pack_start(GTK_BOX(Box),Label,0,0,0); gtk_container_add(GTK_CONTAINER(widgets->ConfigurationModeMenuItem),Box); g_signal_connect(G_OBJECT(widgets->ConfigurationModeMenuItem),"activate",G_CALLBACK(on_configuration_mode_switch),widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 14a02c2..8c229be 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -610,6 +610,7 @@ typedef struct GtkWidget *ReadFullLogButton; GtkWidget *ConfigurationModeMenuItem; + GtkWidget *ConfigurationModeCheck; GtkWidget *EnableVNCMenuItem; GtkWidget *EnableRDPMenuItem; GtkWidget *AboutMenuItem;