|
|
|
|
@ -129,10 +129,9 @@ void on_password_hash_sensitiveness(GtkWidget *,yon_password_window *window){
|
|
|
|
|
const char *hash = gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
|
|
|
|
|
const char *hash_command = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo));
|
|
|
|
|
if (!yon_char_is_empty(hash_command)){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck),1);
|
|
|
|
|
gtk_widget_set_sensitive(window->NoEncriptionCheck,0);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(window->NoEncriptionCheck,1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(window->NoEncriptionCheck,0);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(password)||!yon_char_is_empty(repeat_password)){
|
|
|
|
|
gtk_widget_set_sensitive(window->HashBox,0);
|
|
|
|
|
@ -153,8 +152,12 @@ void on_password_hash_sensitiveness(GtkWidget *,yon_password_window *window){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_changed(GtkWidget *, yon_password_window *window);
|
|
|
|
|
|
|
|
|
|
void yon_password_function_set(yon_password_window *window, double *password_func){
|
|
|
|
|
window->strength_func = password_func;
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"changed",G_CALLBACK(on_password_changed),window);
|
|
|
|
|
gtk_widget_show(window->PasswordStrengthProgress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_accept(GtkWidget *,dictionary *dict){
|
|
|
|
|
@ -183,13 +186,16 @@ void on_password_accept(GtkWidget *,dictionary *dict){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_password_changed(GtkWidget *, yon_password_window *window){
|
|
|
|
|
const char *password_str = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
double strength = ((double(*)(yon_password_window *,const char*))window->strength_func)(window,password_str);
|
|
|
|
|
if (window->strength_func){
|
|
|
|
|
const char *password_str = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
|
|
|
|
|
double strength = ((double(*)(yon_password_window *,const char*))window->strength_func)(window,password_str);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yon_password_window *yon_password_window_new(){
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_password);
|
|
|
|
|
yon_password_window *window = malloc(sizeof(yon_password_window));
|
|
|
|
|
memset(window,0,sizeof(yon_password_window));
|
|
|
|
|
window->Window = yon_gtk_builder_get_widget(builder,"PasswordWindow");
|
|
|
|
|
window->HeadLabel = yon_gtk_builder_get_widget(builder,"userTitleNameLabel");
|
|
|
|
|
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
|
|
|
|
|
@ -210,7 +216,6 @@ yon_password_window *yon_password_window_new(){
|
|
|
|
|
g_signal_connect(G_OBJECT(window->NoEncriptionCheck),"toggled",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordHashEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->PasswordEntry),"changed",G_CALLBACK(on_password_changed),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->RepeatPasswordEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
|
|
|
|
|
gtk_widget_show(window->Window);
|
|
|
|
|
return window;
|
|
|
|
|
|