50 gtk_widget_destroy(GTK_WIDGET(session->
wnd));
51 g_object_unref(G_OBJECT(session->
x));
64 gtk_widget_grab_focus(GTK_WIDGET(data));
84 user = gtk_entry_get_text(session->
user);
85 pass = gtk_entry_get_text(session->
pass);
87 session->
cb(user, pass, session->
cbpw);
103 session->
cb(NULL, NULL, session->
cbpw);
116 const char *username,
117 const char *password,
132 if ((*username == 0) && (*password == 0)) {
133 key =
"LoginDescription";
140 "key:%s url:%s realm:%s str:%s", key, url_s, realm, str);
142 if ((str != NULL) && (strcmp(key, str) != 0)) {
146 const char *fmt =
"The site %s is requesting your username and password. The realm is \"%s\"";
147 slen = snprintf(str, 0, fmt, url_s, realm) + 1;
152 snprintf(str, slen, fmt, url_s, realm);
180 const char *username,
181 const char *password,
183 const char *password,
191 GtkEntry *euser, *epass;
192 GtkButton *bok, *bcan;
194 char *description = NULL;
197 if (session == NULL) {
207 gtk_builder_connect_signals(builder, NULL);
209 wnd = GTK_WINDOW(gtk_builder_get_object(builder,
"LoginDialog"));
210 ldesc = GTK_LABEL(gtk_builder_get_object(builder,
"LoginDescription"));
211 euser = GTK_ENTRY(gtk_builder_get_object(builder,
"LoginUsername"));
212 epass = GTK_ENTRY(gtk_builder_get_object(builder,
"LoginPassword"));
213 bok = GTK_BUTTON(gtk_builder_get_object(builder,
"LoginOK"));
214 bcan = GTK_BUTTON(gtk_builder_get_object(builder,
"LoginCancel"));
219 session->
x = builder;
221 session->
user = euser;
222 session->
pass = epass;
227 gtk_label_set_text(GTK_LABEL(ldesc), description);
230 gtk_entry_set_text(euser, username);
231 gtk_entry_set_text(epass, password);
236 g_signal_connect(G_OBJECT(bok),
"clicked",
238 g_signal_connect(G_OBJECT(bcan),
"clicked",
245 g_signal_connect(G_OBJECT(euser),
"activate",
247 g_signal_connect(G_OBJECT(epass),
"activate",
251 gtk_widget_grab_focus(GTK_WIDGET(euser));
254 gtk_widget_show(GTK_WIDGET(wnd));
264 const char *username,
265 const char *password,
267 const char *password,
275 assert(host != NULL);
280 NSLOG(netsurf, INFO,
"Login init failed");
285 lwc_string_unref(host);
Interface to gtk builtin resource handling.
char * realm
Authentication realm.
static nserror get_login_description(struct nsurl *url, const char *realm, const char *username, const char *password, char **out_str)
generate the description of the login request
Interface to utility string handling.
GtkEntry * user
Widget with username.
Localised message support (interface).
lwc_string * host
Host for user display.
void * cbpw
Continuation data.
nserror gui_401login_open(nsurl *url, const char *realm, const char *username, const char *password, nserror(*cb)(const char *username, const char *password, void *pw), void *cbpw)
login window request.
GtkBuilder * x
Our builder windows.
nserror nsurl_get(const nsurl *url, nsurl_component parts, char **url_s, size_t *url_l)
Get URL (section) as a string, from a NetSurf URL object.
static void nsgtk_login_next(GtkWidget *w, gpointer data)
process next signal in entry widgets.
nserror
Enumeration of error codes.
static void nsgtk_login_cancel_clicked(GtkButton *w, gpointer data)
handler called when navigation is cancelled
#define NSLOG(catname, level, logmsg, args...)
nsurl * url
URL being fetched.
static nserror create_login_window(nsurl *url, lwc_string *host, const char *realm, const char *username, const char *password, nserror(*cb)(const char *username, const char *password, void *pw), void *cbpw)
create a new instance of the login window
lwc_string * nsurl_get_component(const nsurl *url, nsurl_component part)
Get part of a URL as a lwc_string, from a NetSurf URL object.
Unified URL information database public interface.
nserror(* cb)(const char *username, const char *password, void *pw)
Continuation callback.
GtkWindow * wnd
The login window itself.
char * messages_get_buff(const char *key,...)
Formatted message from a key in the global message hash.
nserror nsgtk_builder_new_from_resname(const char *resname, GtkBuilder **builder_out)
Create gtk builder object for the named ui resource.
static void destroy_login_window(struct session_401 *session)
Destroy login window and free all associated resources.
GtkEntry * pass
Widget with password.
NetSurf URL handling (interface).
struct nsurl nsurl
NetSurf URL object.
login window session data
static void nsgtk_login_ok_clicked(GtkButton *w, gpointer data)
handler called when navigation is continued