diff options
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); |