diff options
author | xengineering <me@xengineering.eu> | 2022-10-04 10:49:44 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2022-10-04 10:49:44 +0200 |
commit | e63008f1d2b0423d8dd1cacfb02a2f0c69ae331b (patch) | |
tree | 92bef5f48bafc2213bedd26afe68b5a2b2b75ff1 /gtk.c | |
parent | 50458b4df62fb08d098224ed4d8a5dc82337e184 (diff) | |
download | limox-e63008f1d2b0423d8dd1cacfb02a2f0c69ae331b.tar limox-e63008f1d2b0423d8dd1cacfb02a2f0c69ae331b.tar.zst limox-e63008f1d2b0423d8dd1cacfb02a2f0c69ae331b.zip |
Read credentials from shell env if present
Diffstat (limited to 'gtk.c')
-rw-r--r-- | gtk.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -84,6 +84,23 @@ void send_message(chat_t* chat) { gtk_entry_buffer_delete_text(buffer, 0, -1); } +/* Set credentials from environment variables if given */ +static void set_debug_credentials(GtkWidget* user, GtkWidget* pwd) { + + char* user_str = getenv("LIMOX_USER"); + if (user_str != NULL) { + GtkEntryBuffer* buffer; + buffer = gtk_entry_get_buffer(GTK_ENTRY(user)); + gtk_entry_buffer_set_text(buffer, user_str, -1); + } + + char* pwd_str = getenv("LIMOX_PWD"); + if (pwd_str != NULL) { + gtk_editable_set_text(GTK_EDITABLE(pwd), pwd_str); + } + +} + static void build_static_widgets(void) { // main window with stack @@ -106,6 +123,7 @@ static void build_static_widgets(void) { gtk_box_append(GTK_BOX(connector_box), connector_pwd_entry); connector_button = gtk_button_new_with_label("Connect"); gtk_box_append(GTK_BOX(connector_box), connector_button); + set_debug_credentials(connector_jid_entry, connector_pwd_entry); // roster page roster_layout_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 20); |