summaryrefslogtreecommitdiff
path: root/gtk.c
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-10-04 10:49:44 +0200
committerxengineering <me@xengineering.eu>2022-10-04 10:49:44 +0200
commite63008f1d2b0423d8dd1cacfb02a2f0c69ae331b (patch)
tree92bef5f48bafc2213bedd26afe68b5a2b2b75ff1 /gtk.c
parent50458b4df62fb08d098224ed4d8a5dc82337e184 (diff)
downloadlimox-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.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gtk.c b/gtk.c
index 1aee4d6..3e47fcf 100644
--- a/gtk.c
+++ b/gtk.c
@@ -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);