WIP Added password window

pull/52/head
parent a220e79d80
commit 3b9ee94581
No known key found for this signature in database
GPG Key ID: FF1D842BF4DDE92B

@ -10,6 +10,7 @@
<file>libublsettingsui-gtk3-config-window.glade</file> <file>libublsettingsui-gtk3-config-window.glade</file>
<file>libublsettingsui-gtk3-service-control.glade</file> <file>libublsettingsui-gtk3-service-control.glade</file>
<file>libublsettingsui-gtk3-app-chooser.glade</file> <file>libublsettingsui-gtk3-app-chooser.glade</file>
<file>libublsettingsui-gtk3-password.glade</file>
</gresource> </gresource>
<gresource prefix="/com/ublinux/css"> <gresource prefix="/com/ublinux/css">
<file>libublsettingsui-gtk3.css</file> <file>libublsettingsui-gtk3.css</file>

@ -0,0 +1,333 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface domain="ubl-settings-update">
<requires lib="gtk+" version="3.24"/>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.cancel-uncolored-symbolic</property>
</object>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.accept-symbolic</property>
</object>
<object class="GtkWindow" id="PasswordWindow">
<property name="can-focus">False</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="default-width">450</property>
<property name="icon-name">com.ublinux.ubl-settings-update</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="StatusBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="PasswordBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Password:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="PasswordEntry">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Password</property>
<property name="visibility">False</property>
<property name="invisible-char">*</property>
<property name="truncate-multiline">True</property>
<property name="placeholder-text" translatable="yes">********</property>
<property name="input-purpose">password</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Repeat password:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="RepeatPasswordEntry">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Repeat password</property>
<property name="visibility">False</property>
<property name="invisible-char">*</property>
<property name="truncate-multiline">True</property>
<property name="placeholder-text" translatable="yes">********</property>
<property name="input-purpose">password</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Encryption:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="EncryptionCombo">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Encryption</property>
<property name="active">0</property>
<items>
<item translatable="yes">Default (None)</item>
<item id="echo -n &quot;%s&quot; | sha512sum | cut -f 1 -d ' '" translatable="yes">SHA-512</item>
<item id="echo -n &quot;%s&quot; | sha256sum | cut -f 1 -d ' '" translatable="yes">SHA-256</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="NoEncriptionCheck">
<property name="label" translatable="yes">Do not encrypt password</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkBox" id="HashBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Password hash:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="PasswordHashEntry">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes">Password hash</property>
<property name="visibility">False</property>
<property name="invisible-char">*</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child type="title">
<object class="GtkLabel" id="userTitleNameLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Password input</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkButton" id="UserCancelButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image4</property>
<style>
<class name="button"/>
<class name="marginright"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="UserOkButton">
<property name="label" translatable="yes">Accept</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image5</property>
<style>
<class name="button"/>
<class name="marginright"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkSizeGroup">
<widgets>
<widget name="label3"/>
<widget name="label2"/>
<widget name="label4"/>
</widgets>
</object>
</interface>

@ -46,6 +46,7 @@ set(DEPENDFILES
../libublsettingsui-gtk3-config-window.glade ../libublsettingsui-gtk3-config-window.glade
../libublsettingsui-gtk3-service-control.glade ../libublsettingsui-gtk3-service-control.glade
../libublsettingsui-gtk3-app-chooser.glade ../libublsettingsui-gtk3-app-chooser.glade
../libublsettingsui-gtk3-password.glade
../gresource.xml ../gresource.xml
../libublsettingsui-gtk3-banner.png ../libublsettingsui-gtk3-banner.png
../libublsettingsui-gtk3.css ../libublsettingsui-gtk3.css
@ -85,6 +86,7 @@ add_library(${PROJECT_NAME} SHARED
libublsettingsui-gtk3-service.c libublsettingsui-gtk3-service.c
libublsettingsui-gtk3-app-chooser.c libublsettingsui-gtk3-app-chooser.c
libublsettingsui-gtk3-standard-callbacks.c libublsettingsui-gtk3-standard-callbacks.c
libublsettingsui-gtk3-password.c
libublsettingsui-gtk3.h libublsettingsui-gtk3.h
${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}) ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C})

@ -0,0 +1,228 @@
#include "libublsettingsui-gtk3.h"
#define sha256_encrypt_command(target) yon_char_unite("echo -n \"",target,"\" | sha256sum | cut -f 1 -d ' '",NULL)
#define sha512_encrypt_command(target) yon_char_unite("echo -n \"",target,"\" | sha512sum | cut -f 1 -d ' '",NULL)
yon_password_window *yon_password_window_new();
char *yon_password_unencrypted_password_get(yon_password_window *window){
const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
const char *password_repeat = gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
if (strpbrk(password,"!@#%^&*\'")){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_PASSWORD_RESTRICTED_SYMBOL_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
return NULL;
}
if (strcmp(password,password_repeat)){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
yon_ubl_status_highlight_incorrect(window->RepeatPasswordEntry);
return NULL;
}
if (yon_char_is_empty(password)){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
return NULL;
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){
const char *encryption = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo));
char *final = yon_char_unite(encryption,"|",password,NULL);
return final;
} else {
return yon_char_new(password);
}
}
char *yon_password_hash_get(yon_password_window *window){
int encription_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->EncryptionCombo));
const char *encription = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(window->EncryptionCombo));
const char *encription_command = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo));
const char *hash = gtk_entry_get_text(GTK_ENTRY(window->PasswordHashEntry));
if (!yon_char_is_empty(hash)){
// if (!yon_char_is_empty(window->old_password)&&strcmp(hash,window->old_password)){
switch(encription_active){
case 1:{
if (strlen(hash)!=128){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_INCORRECT_HASH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordHashEntry);
return NULL;
}
}
break;
case 2:{
if (strlen(hash)!=64){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_INCORRECT_HASH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordHashEntry);
return NULL;
}
}
break;
}
// }
char *final = yon_char_unite(encription,"|",hash,NULL);
return final;
} else {
const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
const char *password_repeat = gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
if (strpbrk(password,"!@#%^&*\'")){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_PASSWORD_RESTRICTED_SYMBOL_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
return NULL;
}
if (yon_char_is_empty(password_repeat)){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->RepeatPasswordEntry);
return NULL;
}
if (strcmp(password,password_repeat)){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_PASSWORD_MISMATCH_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
yon_ubl_status_highlight_incorrect(window->PasswordEntry);
yon_ubl_status_highlight_incorrect(window->RepeatPasswordEntry);
return NULL;
}
int size;
config_str hash = yon_config_load(yon_debug_output("%s\n",encription_active==1?sha512_encrypt_command(password):sha256_encrypt_command(password)),&size);
yon_char_remove_last_symbol(hash[0],'\n');
char *final = hash[0];
if (gtk_widget_get_visible(window->EncryptionCombo)){
final = yon_char_unite(encription,"|",hash[0],NULL);
}
return final;
}
return NULL;
}
void on_password_encryption_changed(GtkComboBox *self, yon_password_window *dialog){
int active = gtk_combo_box_get_active(self);
gtk_widget_set_sensitive(dialog->NoEncriptionCheck,!!active);
if (!active)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->NoEncriptionCheck),0);
}
void yon_hash_entry_sensitiveness_update(GtkWidget *, yon_password_window *dialog){
int hash_type_sensitive = gtk_combo_box_get_active(GTK_COMBO_BOX(dialog->EncryptionCombo));
int encrypt_sensitive = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->NoEncriptionCheck));
if (!encrypt_sensitive&&hash_type_sensitive) gtk_widget_set_sensitive(dialog->PasswordHashEntry,1);
else gtk_widget_set_sensitive(dialog->PasswordHashEntry,0);
}
void yon_password_hash_list_set(yon_password_window *window, config_str hashes, config_str get_hash_commands, int size){
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(window->EncryptionCombo));
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),_ENCRYPTION_DEFAULT_LABEL,"");
for (int i=0;i<size;i++){
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),hashes[i],get_hash_commands[i]);
}
}
void on_password_hash_sensitiveness(GtkWidget *,yon_password_window *window){
const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
const char *repeat_password = gtk_entry_get_text(GTK_ENTRY(window->RepeatPasswordEntry));
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);
}
if (!yon_char_is_empty(password)||!yon_char_is_empty(repeat_password)){
gtk_widget_set_sensitive(window->HashBox,0);
gtk_widget_set_sensitive(window->PasswordBox,1);
} else if (yon_char_is_empty(password)&&yon_char_is_empty(repeat_password)&&
gtk_combo_box_get_active(GTK_COMBO_BOX(window->EncryptionCombo))>0&&
yon_char_is_empty(hash)&&!yon_char_is_empty(hash_command)){
gtk_widget_set_sensitive(window->HashBox,1);
gtk_widget_set_sensitive(window->PasswordBox,1);
gtk_widget_set_sensitive(window->NoEncriptionCheck,1);
} else if (!yon_char_is_empty(hash)&&!yon_char_is_empty(hash_command)) {
gtk_widget_set_sensitive(window->HashBox,1);
gtk_widget_set_sensitive(window->PasswordBox,0);
gtk_widget_set_sensitive(window->NoEncriptionCheck,0);
} else {
gtk_widget_set_sensitive(window->HashBox,0);
gtk_widget_set_sensitive(window->PasswordBox,1);
}
}
void on_password_accept(GtkWidget *,dictionary *dict){
yon_password_window *window = yon_dictionary_get_data(dict->first,yon_password_window*);
GtkWidget *target = yon_dictionary_get_data(dict->first->next,GtkWidget*);
int encription_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->EncryptionCombo));
char *final = NULL;
if (encription_active == 0||gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){
final = yon_password_unencrypted_password_get(window);
if (!final) return;
} else {
final = yon_password_hash_get(window);
if (!final) return;
}
gtk_entry_set_text(GTK_ENTRY(target),final);
gtk_widget_destroy(window->Window);
}
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));
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");
window->PasswordEntry = yon_gtk_builder_get_widget(builder,"PasswordEntry");
window->RepeatPasswordEntry = yon_gtk_builder_get_widget(builder,"RepeatPasswordEntry");
window->EncryptionCombo = yon_gtk_builder_get_widget(builder,"EncryptionCombo");
window->NoEncriptionCheck = yon_gtk_builder_get_widget(builder,"NoEncriptionCheck");
window->PasswordHashEntry = yon_gtk_builder_get_widget(builder,"PasswordHashEntry");
window->UserCancelButton = yon_gtk_builder_get_widget(builder,"UserCancelButton");
window->AcceptButton = yon_gtk_builder_get_widget(builder,"UserOkButton");
window->PasswordBox = yon_gtk_builder_get_widget(builder,"PasswordBox");
window->HashBox = yon_gtk_builder_get_widget(builder,"HashBox");
window->old_password=NULL;
g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->EncryptionCombo),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
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->RepeatPasswordEntry),"changed",G_CALLBACK(on_password_hash_sensitiveness),window);
gtk_widget_show(window->Window);
return window;
}
yon_password_window *yon_password_open(GtkEntry *target){
g_return_val_if_fail(GTK_IS_ENTRY(target),NULL);
yon_password_window *dialog = yon_password_window_new();
g_signal_connect(G_OBJECT(dialog->NoEncriptionCheck),"toggled",G_CALLBACK(yon_hash_entry_sensitiveness_update),dialog);
g_signal_connect(G_OBJECT(dialog->EncryptionCombo),"changed",G_CALLBACK(yon_hash_entry_sensitiveness_update),dialog);
yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(dialog->PasswordEntry));
yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(dialog->PasswordHashEntry));
yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(dialog->RepeatPasswordEntry));
char *old_password = yon_char_new(gtk_entry_get_text(target));
char *hash_type = NULL;
if (!yon_char_is_empty(old_password)&&strstr(old_password,"|")){
hash_type = yon_char_divide(old_password,6);
gtk_combo_box_set_active_id(GTK_COMBO_BOX(dialog->EncryptionCombo),hash_type);
}
if (!yon_char_is_empty(old_password)&&(strlen(old_password)==128||strlen(old_password)==64)){
dialog->old_password = old_password;
gtk_entry_set_text(GTK_ENTRY(dialog->PasswordHashEntry),old_password);
} else if (!yon_char_is_empty(old_password)){
dialog->old_password = old_password;
gtk_entry_set_text(GTK_ENTRY(dialog->PasswordEntry),old_password);
gtk_entry_set_text(GTK_ENTRY(dialog->RepeatPasswordEntry),old_password);
}
dictionary *dict = NULL;
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",dialog);
yon_dictionary_add_or_create_if_exists_with_data(dict,"target",target);
g_signal_connect(G_OBJECT(dialog->AcceptButton),"clicked",G_CALLBACK(on_password_accept),dict);
g_signal_connect(G_OBJECT(dialog->EncryptionCombo),"changed",G_CALLBACK(on_password_encryption_changed),dialog);
return dialog;
}

@ -45,6 +45,9 @@
/**Путь до файла окна выбора приложений утилит ubl-settings-**/ /**Путь до файла окна выбора приложений утилит ubl-settings-**/
#define ui_glade_path_app_chooser "/com/ublinux/ui/libublsettingsui-gtk3-app-chooser.glade" #define ui_glade_path_app_chooser "/com/ublinux/ui/libublsettingsui-gtk3-app-chooser.glade"
/**Путь до файла окна ввода пароля */
#define ui_glade_path_password "/com/ublinux/ui/libublsettingsui-gtk3-password.glade"
/**Путь до основного баннера утилит ubl-settings-**/ /**Путь до основного баннера утилит ubl-settings-**/
#define ui_banner_path "/com/ublinux/images/libublsettingsui-gtk3-banner.png" #define ui_banner_path "/com/ublinux/images/libublsettingsui-gtk3-banner.png"
@ -456,6 +459,34 @@ int yon_app_chooser_window_select(yon_app_chooser_window *window,config_str sele
config_str yon_app_chooser_window_run(yon_app_chooser_window *window, int *size); config_str yon_app_chooser_window_run(yon_app_chooser_window *window, int *size);
yon_app_chooser_window *yon_app_chooser_window_new(int multiple_choise); yon_app_chooser_window *yon_app_chooser_window_new(int multiple_choise);
typedef struct {
GtkWidget *Window;
GtkWidget *HeadLabel;
GtkWidget *StatusBox;
GtkWidget *PasswordEntry;
GtkWidget *RepeatPasswordEntry;
GtkWidget *EncryptionCombo;
GtkWidget *NoEncriptionCheck;
GtkWidget *PasswordHashEntry;
GtkWidget *UserCancelButton;
GtkWidget *AcceptButton;
GtkWidget *PasswordBox;
GtkWidget *HashBox;
const char *old_password;
} yon_password_window;
/// @brief
/// @param window окно с паролем
/// @param hashes массив с названиями типов хэша
/// @param get_hash_commands массив с командами получения хэша. Если команда == NULL, получение хэша пароля блокируется
/// @param size размер hashes и get_hash_commands. Оба массива должны быть одного размера
void yon_password_hash_list_set(yon_password_window *window, config_str hashes, config_str get_hash_commands, int size);
yon_password_window *yon_password_open(GtkEntry *target);
#define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",NULL) #define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",NULL)
#define HELP_LABEL(rest) yon_char_unite(template_app_information.app_tech_name,_(" version:")," ", !yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",\ #define HELP_LABEL(rest) yon_char_unite(template_app_information.app_tech_name,_(" version:")," ", !yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",\
template_app_information.app_title,"\n",_("Usage:"), " ",template_app_information.app_tech_name," ",_("[OPTIONS]"),"\n",\ template_app_information.app_title,"\n",_("Usage:"), " ",template_app_information.app_tech_name," ",_("[OPTIONS]"),"\n",\
@ -575,6 +606,14 @@ yon_app_chooser_window *yon_app_chooser_window_new(int multiple_choise);
#define _SERVICE_ACTIVE_STATUS_LABEL(target) yon_char_unite("\"",target,"\" ", yon_char_get_localised_from_lib(_("service is active")),NULL) #define _SERVICE_ACTIVE_STATUS_LABEL(target) yon_char_unite("\"",target,"\" ", yon_char_get_localised_from_lib(_("service is active")),NULL)
#define _SERVICE_INACTIVE_STATUS_LABEL(target) yon_char_unite("\"",target,"\" ",yon_char_get_localised_from_lib(_("service is inactive")),NULL) #define _SERVICE_INACTIVE_STATUS_LABEL(target) yon_char_unite("\"",target,"\" ",yon_char_get_localised_from_lib(_("service is inactive")),NULL)
#define _PASSWORD_TITLE_LABEL yon_char_get_localised_from_lib("Password")
#define UNSAVED_LABEL yon_char_get_localised_from_lib("The changes were not saved to either the local or global configuration file.\nQuit without saving?") #define UNSAVED_LABEL yon_char_get_localised_from_lib("The changes were not saved to either the local or global configuration file.\nQuit without saving?")
#define EXIT_LABEL yon_char_get_localised_from_lib("Exit") #define EXIT_LABEL yon_char_get_localised_from_lib("Exit")
#define _PASSWORD_MISMATCH_LABEL yon_char_get_localised_from_lib("Passwords do not match")
#define _PASSWORD_RESTRICTED_SYMBOL_LABEL yon_char_get_localised_from_lib("Password contains restricted symbols")
#define _EMPTY_IMPORTANT_LABEL yon_char_get_localised_from_lib("Empty important field!")
#define _INCORRECT_HASH_LABEL yon_char_get_localised_from_lib("Invalid hash")
#define _ENCRYPTION_DEFAULT_LABEL yon_char_get_localised_from_lib("Default (None)")
#endif #endif
Loading…
Cancel
Save