From 54c7258ecef5f7c3b476ea51d6b8b5785d649015 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Mon, 27 Sep 2021 10:53:31 +0100 Subject: [PATCH] Disable password entry if open is toggeld --- src/ui/ui.c | 17 +++++++++++++++-- src/ui/ui.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ui/ui.c b/src/ui/ui.c index dc67713..418b05e 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -414,7 +414,8 @@ int initUi(int argc, char *argv[]){ g_signal_connect (button_create_hp, "clicked", G_CALLBACK(on_create_hp_clicked), NULL); g_signal_connect (button_stop_hp, "clicked", G_CALLBACK(on_stop_hp_clicked), NULL); g_signal_connect (button_about, "clicked", G_CALLBACK(on_about_open_click), NULL); - g_signal_connect (button_refresh, "clicked", G_CALLBACK(on_refresh_clicked), NULL); //new + g_signal_connect (button_refresh, "clicked", G_CALLBACK(on_refresh_clicked), NULL); + g_signal_connect (cb_open, "toggled", G_CALLBACK(on_cb_open_clicked), NULL); //new g_signal_connect (entry_mac, "changed", G_CALLBACK(entry_mac_warn), NULL); g_signal_connect (entry_ssd, "changed", G_CALLBACK(entry_ssid_warn), NULL); @@ -938,4 +939,16 @@ static void on_refresh_clicked(GtkWidget *widget, gpointer data) else { clear_connecetd_devices_list(); } -} \ No newline at end of file +} + +/** + * When open checkbutton is toogled, disable password entry +*/ +static void on_cb_open_clicked(GtkWidget *widget, gpointer data) +{ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { + gtk_widget_set_sensitive((GtkWidget*)entry_pass, FALSE); + } else { + gtk_widget_set_sensitive((GtkWidget*)entry_pass, TRUE); + } +} diff --git a/src/ui/ui.h b/src/ui/ui.h index a78b61c..21466e6 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -74,6 +74,8 @@ static void set_connected_devices_label(); // new static void on_refresh_clicked(GtkWidget *widget, gpointer data); +static void on_cb_open_clicked(GtkWidget *widget, gpointer data); + static void clear_connecetd_devices_list(); #endif //WIHOTSPOT_UI_H