|
|
|
|
@ -452,6 +452,10 @@ void on_language_changed(GtkComboBox *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_terminal_command_ended(VteTerminal *terminal, gint status, domain_info_window *window){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"success",SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
domain_info_window *yon_information_window_new(){
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_domain_view_path);
|
|
|
|
|
|
|
|
|
|
@ -466,6 +470,8 @@ domain_info_window *yon_information_window_new(){
|
|
|
|
|
vte_terminal_get_color_background_for_draw(VTE_TERMINAL(window->ExecuteTerminal),&rgba);
|
|
|
|
|
vte_terminal_set_color_cursor(VTE_TERMINAL(window->ExecuteTerminal),&rgba);
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,TITLE_LABEL,"com.ublinux.ubl-settings-system","InfoWindow");
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"loading",LOADING_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->ExecuteTerminal), "child-exited", G_CALLBACK(on_terminal_command_ended), window);
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
@ -490,6 +496,8 @@ void on_domain_connect(GtkWidget *self, dictionary *dict){
|
|
|
|
|
char *final = yon_char_unite(!yon_char_is_empty(kerberos)?kerberos_addition_command(kerberos):"",!yon_char_is_empty(kerberos)?" ":"",!yon_char_is_empty(dns)?dns_addition_command(dns):"",!yon_char_is_empty(dns)?" ":"",!yon_char_is_empty(client)?client_addition_command(client):"",!yon_char_is_empty(client)?" ":"",NULL);
|
|
|
|
|
yon_debug_output("%s\n",domain_connect_command(adress,login,password,final));
|
|
|
|
|
domain_info_window *dialog = yon_information_window_new();
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(dialog->HeadLabel),DOMAIN_CONNECTING_LABEL);
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog->Window),DOMAIN_CONNECTING_LABEL);
|
|
|
|
|
yon_terminal_integrated_start(dialog->ExecuteTerminal,domain_connect_command(adress,login,password,final));
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window));
|
|
|
|
|
gtk_widget_show(dialog->Window);
|
|
|
|
|
@ -530,6 +538,8 @@ void on_main_window_domain_status_clicked(GtkWidget *self, GtkEntryIconPosition
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int update_thread_buzy = 0;
|
|
|
|
|
|
|
|
|
|
gboolean on_main_window_domain_status_update(connection_window *window){
|
|
|
|
|
const char *target = gtk_entry_get_text(GTK_ENTRY(window->AdressEntry));
|
|
|
|
|
if (!yon_char_is_empty(target)){
|
|
|
|
|
@ -542,20 +552,29 @@ gboolean on_main_window_domain_status_update(connection_window *window){
|
|
|
|
|
} else {
|
|
|
|
|
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(window->AdressEntry),GTK_ENTRY_ICON_SECONDARY,domain_disconnected_icon);
|
|
|
|
|
}
|
|
|
|
|
update_thread_buzy = 0;
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean yon_update_thread(GtkWidget *self, GdkEvent *event, connection_window *window){
|
|
|
|
|
pthread_t thread_id;
|
|
|
|
|
pthread_create(&thread_id, NULL, (void *)on_main_window_domain_status_update,window);
|
|
|
|
|
// gboolean yon_update_thread(GtkWidget *self, GdkEvent *event, connection_window *window){
|
|
|
|
|
gboolean yon_update_thread(connection_window *window){
|
|
|
|
|
if (!update_thread_buzy){
|
|
|
|
|
update_thread_buzy=1;
|
|
|
|
|
pthread_t thread_id;
|
|
|
|
|
pthread_create(&thread_id, NULL, (void *)on_main_window_domain_status_update,window);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
void remove_checking(GtkWidget *self, connection_window *window){
|
|
|
|
|
g_source_remove(window->timer_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connection_window *yon_connection_window_new(){
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_connection_path);
|
|
|
|
|
connection_window *window = malloc(sizeof(connection_window));
|
|
|
|
|
window->Window = yon_gtk_builder_get_widget(builder,"MainWindow");
|
|
|
|
|
window->AdressEntry = yon_gtk_builder_get_widget(builder,"AdressEntry");
|
|
|
|
|
window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel");
|
|
|
|
|
window->StatusEntry = yon_gtk_builder_get_widget(builder,"StatusEntry");
|
|
|
|
|
window->FindEntry = yon_gtk_builder_get_widget(builder,"FindEntry");
|
|
|
|
|
window->LoginEntry = yon_gtk_builder_get_widget(builder,"LoginEntry");
|
|
|
|
|
@ -572,8 +591,10 @@ connection_window *yon_connection_window_new(){
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->StatusEntry),"clicked",G_CALLBACK(on_status_clicked),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->FindEntry),"clicked",G_CALLBACK(on_find_domains_clicked),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->AdressEntry),"focus-out-event",G_CALLBACK(yon_update_thread),window);
|
|
|
|
|
yon_update_thread(NULL,NULL,window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(remove_checking),window);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->AdressEntry),"focus-out-event",G_CALLBACK(yon_update_thread),window);
|
|
|
|
|
// yon_update_thread(NULL,NULL,window);
|
|
|
|
|
window->timer_id = g_timeout_add(1000,(GSourceFunc)yon_update_thread,window);
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -590,6 +611,8 @@ void on_domain_disconnect(GtkWidget *self, dictionary *dict){
|
|
|
|
|
}
|
|
|
|
|
yon_debug_output("%s\n",domain_disconnect_command(adress,login,password));
|
|
|
|
|
domain_info_window *dialog = yon_information_window_new();
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(dialog->HeadLabel),DISCONNECTION_LABEL);
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog->Window),DISCONNECTION_LABEL);
|
|
|
|
|
yon_terminal_integrated_start(dialog->ExecuteTerminal,domain_disconnect_command(adress,login,password));
|
|
|
|
|
gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window));
|
|
|
|
|
gtk_widget_show(dialog->Window);
|
|
|
|
|
@ -602,6 +625,7 @@ domain_window *yon_domain_window_new(){
|
|
|
|
|
domain_window *window = malloc(sizeof(domain_window));
|
|
|
|
|
window->Window = yon_gtk_builder_get_widget(builder,"MainWindow");
|
|
|
|
|
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel");
|
|
|
|
|
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
window->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton");
|
|
|
|
|
window->AdressEntry = yon_gtk_builder_get_widget(builder,"AdressEntry");
|
|
|
|
|
@ -616,7 +640,8 @@ domain_window *yon_domain_window_new(){
|
|
|
|
|
void on_domain_opened(GtkWidget *self, main_window *widgets){
|
|
|
|
|
if (main_config.domain_connected){
|
|
|
|
|
domain_window *window = yon_domain_window_new();
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),TITLE_LABEL,"com.ublinux.ubl-settings-system","DomainWindow");
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeadLabel),DOMAIN_CONNECTING_LABEL);
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DISCONNECTION_LABEL,"com.ublinux.ubl-settings-system","DomainWindow");
|
|
|
|
|
char *domain = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->DomainEntry));
|
|
|
|
|
char *password = yon_config_get_by_key(DOMAIN_ADMANGER);
|
|
|
|
|
char *login = yon_char_divide_search(password,":",-1);
|
|
|
|
|
@ -638,7 +663,8 @@ void on_domain_opened(GtkWidget *self, main_window *widgets){
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
} else {
|
|
|
|
|
connection_window *window = yon_connection_window_new();
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),TITLE_LABEL,"com.ublinux.ubl-settings-system","ConnectWindow");
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeadLabel),DOMAIN_CONNECTING_LABEL);
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DOMAIN_CONNECTING_LABEL,"com.ublinux.ubl-settings-system","ConnectWindow");
|
|
|
|
|
char *domain = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->DomainEntry));
|
|
|
|
|
char *dns = config(DOMAIN_DNS);
|
|
|
|
|
char *client = yon_config_get_by_key(DOMAIN_CLIENT);
|
|
|
|
|
@ -662,7 +688,7 @@ void on_domain_opened(GtkWidget *self, main_window *widgets){
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_domain_connect),dict);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_check_domain_connected),widgets);
|
|
|
|
|
yon_update_thread(NULL,NULL,window);
|
|
|
|
|
// yon_update_thread(NULL,NULL,window);
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|