static void session_authenticate (SoupSession *session, SoupMessage *msg, SoupAuth *auth, gboolean retrying, gpointer user_data)
{
	GnomeKeyringResult result;
	gchar *user = NULL;
	gchar *password = NULL;

	// Get the previous user name that was used for this uri
	// TODO Gconf stuff

	// There wasn't one, so let's use the logged in user's name
	if (!user)
		user = g_strdup(getenv("USER"));

	if (retrying)
	{
		// Prompt the user if there were no valid credentials in the keyring
		GtkWidget *user_field = NULL;
		GtkWidget *pass_field = NULL;
		GtkWidget *dialog = get_credentials_dialog(user, soup_auth_get_realm(auth), soup_auth_get_host(auth), &user_field, &pass_field);
		gint response = gtk_dialog_run(GTK_DIALOG (dialog));
		if (response == GTK_RESPONSE_REJECT)
		{
			gtk_widget_destroy(dialog);
			return;
		}
		g_free(user);
		user = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_field)));
		password = g_strdup(gtk_entry_get_text(GTK_ENTRY(pass_field)));
		gtk_widget_destroy(dialog);

		// Store password in the keyring
		gchar * description = g_strdup_printf("Nautilus-Sendto-Trac:%s:%s", soup_auth_get_host(auth), soup_auth_get_realm(auth));
		result = gnome_keyring_store_password_sync(HTTP_AUTH_SCHEMA, NULL, description, password,
				"host", soup_auth_get_host(auth),
				"realm", soup_auth_get_realm(auth),
				"user", user,
				NULL);
		g_free(description);
		g_free(password);
	}

	// Try and get a password for the user from the keyring
	result = gnome_keyring_find_password_sync(HTTP_AUTH_SCHEMA, &password,
			"host", soup_auth_get_host(auth),
			"realm", soup_auth_get_realm(auth),
			"user", user,
			NULL);
	if (result != GNOME_KEYRING_RESULT_OK)
		password = "";

	// Do the authentication
	soup_auth_authenticate(auth, user, password);
	g_free(user);
	if (result == GNOME_KEYRING_RESULT_OK)
		gnome_keyring_free_password(password);
	return;
}
Esempio n. 2
0
static void
soup_auth_get_property (GObject *object, guint prop_id,
			GValue *value, GParamSpec *pspec)
{
	SoupAuth *auth = SOUP_AUTH (object);
	SoupAuthPrivate *priv = SOUP_AUTH_GET_PRIVATE (object);

	switch (prop_id) {
	case PROP_SCHEME_NAME:
		g_value_set_string (value, soup_auth_get_scheme_name (auth));
		break;
	case PROP_REALM:
		if (auth->realm)
			g_free (auth->realm);
		g_value_set_string (value, soup_auth_get_realm (auth));
		break;
	case PROP_HOST:
		if (priv->host)
			g_free (priv->host);
		g_value_set_string (value, soup_auth_get_host (auth));
		break;
	case PROP_IS_FOR_PROXY:
		g_value_set_boolean (value, priv->proxy);
		break;
	case PROP_IS_AUTHENTICATED:
		g_value_set_boolean (value, soup_auth_is_authenticated (auth));
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
Esempio n. 3
0
static gchar*
katze_http_auth_soup_auth_get_hash (SoupAuth* auth)
{
    return g_strdup_printf ("%s:%s:%s",
        soup_auth_get_host (auth),
        soup_auth_get_scheme_name (auth),
        soup_auth_get_realm (auth));
}
Esempio n. 4
0
static void
digest_nonce_authenticate (SoupSession *session, SoupMessage *msg,
			   SoupAuth *auth, gboolean retrying, gpointer data)
{
	if (retrying)
		return;

	if (strcmp (soup_auth_get_scheme_name (auth), "Digest") != 0 ||
	    strcmp (soup_auth_get_realm (auth), "realm1") != 0)
		return;

	soup_auth_authenticate (auth, "user1", "realm1");
}
Esempio n. 5
0
static void
bug271540_authenticate (SoupSession *session, SoupMessage *msg,
			SoupAuth *auth, gboolean retrying, gpointer data)
{
	int n = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (msg), "#"));
	gboolean *authenticated = data;

	if (strcmp (soup_auth_get_scheme_name (auth), "Basic") != 0 ||
	    strcmp (soup_auth_get_realm (auth), "realm1") != 0)
		return;

	if (!*authenticated) {
		debug_printf (1, "    authenticating message %d\n", n);
		soup_auth_authenticate (auth, "user1", "realm1");
		*authenticated = TRUE;
	} else {
		debug_printf (1, "    asked to authenticate message %d after authenticating!\n", n);
		errors++;
	}
}
static ProtectionSpace protectionSpaceFromSoupAuthAndMessage(SoupAuth* soupAuth, SoupMessage* message)
{
    const char* schemeName = soup_auth_get_scheme_name(soupAuth);
    ProtectionSpaceAuthenticationScheme scheme;
    if (!g_ascii_strcasecmp(schemeName, "basic"))
        scheme = ProtectionSpaceAuthenticationSchemeHTTPBasic;
    else if (!g_ascii_strcasecmp(schemeName, "digest"))
        scheme = ProtectionSpaceAuthenticationSchemeHTTPDigest;
    else if (!g_ascii_strcasecmp(schemeName, "ntlm"))
        scheme = ProtectionSpaceAuthenticationSchemeNTLM;
    else if (!g_ascii_strcasecmp(schemeName, "negotiate"))
        scheme = ProtectionSpaceAuthenticationSchemeNegotiate;
    else
        scheme = ProtectionSpaceAuthenticationSchemeUnknown;

    SoupURI* soupURI = soup_message_get_uri(message);
    return ProtectionSpace(String::fromUTF8(soup_uri_get_host(soupURI)), soup_uri_get_port(soupURI),
        protectionSpaceServerTypeFromURI(soupURI, soup_auth_is_for_proxy(soupAuth)),
        String::fromUTF8(soup_auth_get_realm(soupAuth)), scheme);
}
static void show_auth_dialog(WebKitAuthData* authData, const char* login, const char* password)
{
    GtkWidget* toplevel;
    GtkWidget* widget;
    GtkDialog* dialog;
    GtkWindow* window;
    GtkWidget* entryContainer;
    GtkWidget* hbox;
    GtkWidget* mainVBox;
    GtkWidget* vbox;
    GtkWidget* icon;
    GtkWidget* table;
    GtkWidget* serverMessageDescriptionLabel;
    GtkWidget* serverMessageLabel;
    GtkWidget* descriptionLabel;
    char* description;
    const char* realm;
    gboolean hasRealm;
    SoupURI* uri;
    GtkWidget* rememberBox;
    GtkWidget* checkButton;

    /* From GTK+ gtkmountoperation.c, modified and simplified. LGPL 2 license */

    widget = gtk_dialog_new();
    window = GTK_WINDOW(widget);
    dialog = GTK_DIALOG(widget);

    gtk_dialog_add_buttons(dialog,
                           GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                           GTK_STOCK_OK, GTK_RESPONSE_OK,
                           NULL);

    /* Set the dialog up with HIG properties */
    gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
    gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(dialog)), 2); /* 2 * 5 + 2 = 12 */
    gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_action_area(dialog)), 5);
    gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_action_area(dialog)), 6);

    gtk_window_set_resizable(window, FALSE);
    gtk_window_set_title(window, "");
    gtk_window_set_icon_name(window, GTK_STOCK_DIALOG_AUTHENTICATION);

    gtk_dialog_set_default_response(dialog, GTK_RESPONSE_OK);

    /* Get the current toplevel */
    g_signal_emit(authData->manager, signals[CURRENT_TOPLEVEL], 0, authData->msg, &toplevel);

    if (toplevel)
        gtk_window_set_transient_for(window, GTK_WINDOW(toplevel));

    /* Build contents */
    hbox = gtk_hbox_new(FALSE, 12);
    gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(dialog)), hbox, TRUE, TRUE, 0);

    icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION,
                                    GTK_ICON_SIZE_DIALOG);

    gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0);
    gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0);

    mainVBox = gtk_vbox_new(FALSE, 18);
    gtk_box_pack_start(GTK_BOX(hbox), mainVBox, TRUE, TRUE, 0);

    uri = soup_message_get_uri(authData->msg);
    description = g_strdup_printf(_("A username and password are being requested by the site %s"), uri->host);
    descriptionLabel = gtk_label_new(description);
    g_free(description);
    gtk_misc_set_alignment(GTK_MISC(descriptionLabel), 0.0, 0.5);
    gtk_label_set_line_wrap(GTK_LABEL(descriptionLabel), TRUE);
    gtk_box_pack_start(GTK_BOX(mainVBox), GTK_WIDGET(descriptionLabel),
                       FALSE, FALSE, 0);

    vbox = gtk_vbox_new(FALSE, 6);
    gtk_box_pack_start(GTK_BOX(mainVBox), vbox, FALSE, FALSE, 0);

    /* The table that holds the entries */
    entryContainer = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);

    gtk_alignment_set_padding(GTK_ALIGNMENT(entryContainer),
                              0, 0, 0, 0);

    gtk_box_pack_start(GTK_BOX(vbox), entryContainer,
                       FALSE, FALSE, 0);

    realm = soup_auth_get_realm(authData->auth);
    // Checking that realm is not an empty string
    hasRealm = (realm && (strlen(realm) > 0));

    table = gtk_table_new(hasRealm ? 3 : 2, 2, FALSE);
    gtk_table_set_col_spacings(GTK_TABLE(table), 12);
    gtk_table_set_row_spacings(GTK_TABLE(table), 6);
    gtk_container_add(GTK_CONTAINER(entryContainer), table);

    if (hasRealm) {
        serverMessageDescriptionLabel = gtk_label_new(_("Server message:"));
        serverMessageLabel = gtk_label_new(realm);
        gtk_misc_set_alignment(GTK_MISC(serverMessageDescriptionLabel), 0.0, 0.5);
        gtk_label_set_line_wrap(GTK_LABEL(serverMessageDescriptionLabel), TRUE);
        gtk_misc_set_alignment(GTK_MISC(serverMessageLabel), 0.0, 0.5);
        gtk_label_set_line_wrap(GTK_LABEL(serverMessageLabel), TRUE);

        gtk_table_attach_defaults(GTK_TABLE(table), serverMessageDescriptionLabel,
                                  0, 1, 0, 1);
        gtk_table_attach_defaults(GTK_TABLE(table), serverMessageLabel,
                                  1, 2, 0, 1);
    }

    authData->loginEntry = table_add_entry(table, hasRealm ? 1 : 0, _("Username:"******"Password:"******"_Remember password"));
        if (login && password)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkButton), TRUE);
        gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(checkButton))), TRUE);
        gtk_box_pack_start(GTK_BOX(rememberBox), checkButton, FALSE, FALSE, 0);
        authData->checkButton = checkButton;
    }

    g_signal_connect(dialog, "response", G_CALLBACK(response_callback), authData);
    gtk_widget_show_all(widget);
}
Esempio n. 8
0
static void
katze_http_auth_session_authenticate_cb (SoupSession*   session,
                                         SoupMessage*   msg,
                                         SoupAuth*      auth,
                                         gboolean       retrying,
                                         KatzeHttpAuth* http_auth)
{
    gchar* opaque_info;
    KatzeHttpAuthLogin* login;
    GtkWidget* dialog;
    GtkSizeGroup* sizegroup;
    GtkWidget* hbox;
    GtkWidget* image;
    GtkWidget* label;
    GtkWidget* align;
    GtkWidget* entry;
    KatzeHttpAuthSave* save;

    /* We want to ask for authentication exactly once, so we
       enforce this with a tag. There might be a better way. */
    if (!retrying && g_object_get_data (G_OBJECT (msg), "katze-session-tag"))
        return;

    if (1)
    {
        /* We use another tag to indicate whether a message is paused.
           There doesn't seem to be API in libSoup to find that out. */
        soup_session_pause_message (session, g_object_ref (msg));
        g_object_set_data (G_OBJECT (msg), "paused", (void*)1);
    }
    g_object_set_data (G_OBJECT (msg), "katze-session-tag", (void*)1);

    opaque_info = katze_http_auth_soup_auth_get_hash (auth);
    login = g_hash_table_lookup (http_auth->logins, opaque_info);
    g_free (opaque_info);

    dialog = gtk_dialog_new_with_buttons (_("Authentication Required"),
        NULL,
        GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
        GTK_STOCK_OK, GTK_RESPONSE_OK,
        NULL);
    gtk_window_set_icon_name (GTK_WINDOW (dialog),
        GTK_STOCK_DIALOG_AUTHENTICATION);
    gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
    gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 5);

    gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 5);
    hbox = gtk_hbox_new (FALSE, 6);
    image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION,
                                      GTK_ICON_SIZE_DIALOG);
    gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
    label = gtk_label_new (_("A username and a password are required\n"
                             "to open this location:"));
    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
    label = gtk_label_new (soup_auth_get_host (auth));
    gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label, FALSE, TRUE, 0);
    /* If the realm is merely the host, omit the realm label */
    if (g_strcmp0 (soup_auth_get_host (auth), soup_auth_get_realm (auth)))
    {
        label = gtk_label_new (soup_auth_get_realm (auth));
        gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), label, FALSE, TRUE, 0);
    }
    sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
    hbox = gtk_hbox_new (FALSE, 6);
    label = gtk_label_new (_("Username"));
    align = gtk_alignment_new (0, 0.5, 0, 0);
    gtk_container_add (GTK_CONTAINER (align), label);
    gtk_size_group_add_widget (sizegroup, align);
    gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, 0);
    entry = gtk_entry_new ();
    if (login)
        gtk_entry_set_text (GTK_ENTRY (entry), login->username);
    gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
    gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
    g_object_set_data (G_OBJECT (dialog), "username", entry);
    gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
    hbox = gtk_hbox_new (FALSE, 6);
    label = gtk_label_new (_("Password"));
    align = gtk_alignment_new (0, 0.5, 0, 0);
    gtk_container_add (GTK_CONTAINER (align), label);
    gtk_size_group_add_widget (sizegroup, align);
    gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, 0);
    entry = gtk_entry_new ();
    if (login)
        gtk_entry_set_text (GTK_ENTRY (entry), login->password);
    gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
    gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
    gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
    g_object_set_data (G_OBJECT (dialog), "password", entry);
    gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
    hbox = gtk_hbox_new (FALSE, 6);
    label = gtk_check_button_new_with_mnemonic (_("_Remember password"));
    gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
    g_object_set_data (G_OBJECT (dialog), "remember", label);
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (label), (login != NULL));
    gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, TRUE, 0);
    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
    gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));

    g_object_set_data (G_OBJECT (dialog), "session", session);
    g_object_set_data (G_OBJECT (dialog), "msg", msg);

    save = g_slice_new0 (KatzeHttpAuthSave);
    save->http_auth = http_auth;
    save->auth = g_object_ref (auth);
    g_signal_connect (dialog, "response",
        G_CALLBACK (authentication_dialog_response_cb), save);
    gtk_widget_show (dialog);
}
GtkAuthenticationDialog::GtkAuthenticationDialog(GtkWindow* parentWindow, SoupSession* session, SoupMessage* message, SoupAuth* auth)
    : m_dialog(gtk_dialog_new())
    , m_session(session)
    , m_message(message)
    , m_auth(auth)
    , m_loginEntry(0)
    , m_passwordEntry(0)
    , m_rememberCheckButton(0)
#ifdef SOUP_TYPE_PASSWORD_MANAGER
    , m_isSavingPassword(false)
    , m_savePasswordHandler(0)
#endif
{
    GtkDialog* dialog = GTK_DIALOG(m_dialog);
    gtk_dialog_add_buttons(dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);

    // Set the dialog up with HIG properties.
    gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
    gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(dialog)), 2); /* 2 * 5 + 2 = 12 */
    gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_action_area(dialog)), 5);
    gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_action_area(dialog)), 6);

    GtkWindow* window = GTK_WINDOW(m_dialog);
    gtk_window_set_resizable(window, FALSE);
    gtk_window_set_title(window, "");
    gtk_window_set_icon_name(window, GTK_STOCK_DIALOG_AUTHENTICATION);

    gtk_dialog_set_default_response(dialog, GTK_RESPONSE_OK);

    if (parentWindow)
        gtk_window_set_transient_for(window, parentWindow);

    // Build contents.
#ifdef GTK_API_VERSION_2
    GtkWidget* hBox = gtk_hbox_new(FALSE, 12);
#else
    GtkWidget* hBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
#endif
    gtk_container_set_border_width(GTK_CONTAINER(hBox), 5);
    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(dialog)), hBox, TRUE, TRUE, 0);

    GtkWidget* icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG);
    gtk_misc_set_alignment(GTK_MISC(icon), 0.5, 0.0);
    gtk_box_pack_start(GTK_BOX(hBox), icon, FALSE, FALSE, 0);

#ifdef GTK_API_VERSION_2
    GtkWidget* mainVBox = gtk_vbox_new(FALSE, 18);
#else
    GtkWidget* mainVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18);
#endif
    gtk_box_pack_start(GTK_BOX(hBox), mainVBox, TRUE, TRUE, 0);

    SoupURI* uri = soup_message_get_uri(m_message.get());
    GOwnPtr<char>description(g_strdup_printf(_("A username and password are being requested by the site %s"), uri->host));
    GtkWidget* descriptionLabel = gtk_label_new(description.get());
    gtk_misc_set_alignment(GTK_MISC(descriptionLabel), 0.0, 0.5);
    gtk_label_set_line_wrap(GTK_LABEL(descriptionLabel), TRUE);
    gtk_box_pack_start(GTK_BOX(mainVBox), GTK_WIDGET(descriptionLabel), FALSE, FALSE, 0);

#ifdef GTK_API_VERSION_2
    GtkWidget* vBox = gtk_vbox_new(FALSE, 6);
#else
    GtkWidget* vBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
#endif
    gtk_box_pack_start(GTK_BOX(mainVBox), vBox, FALSE, FALSE, 0);

    // The table that holds the entries.
    GtkWidget* entryContainer = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
    gtk_alignment_set_padding(GTK_ALIGNMENT(entryContainer), 0, 0, 0, 0);
    gtk_box_pack_start(GTK_BOX(vBox), entryContainer, FALSE, FALSE, 0);

    const char* realm = soup_auth_get_realm(m_auth);
    // Checking that realm is not an empty string.
    bool hasRealm = (realm && realm[0] != '\0');

#ifdef GTK_API_VERSION_2
    GtkWidget* table = gtk_table_new(hasRealm ? 3 : 2, 2, FALSE);
    gtk_table_set_col_spacings(GTK_TABLE(table), 12);
    gtk_table_set_row_spacings(GTK_TABLE(table), 6);
    gtk_container_add(GTK_CONTAINER(entryContainer), table);
#else
    GtkWidget* grid = gtk_grid_new();
    gtk_grid_set_column_spacing(GTK_GRID(grid), 12);
    gtk_grid_set_row_spacing(GTK_GRID(grid), 6);
    gtk_container_add(GTK_CONTAINER(entryContainer), grid);
#endif

    if (hasRealm) {
        GtkWidget* serverMessageDescriptionLabel = gtk_label_new(_("Server message:"));
        gtk_misc_set_alignment(GTK_MISC(serverMessageDescriptionLabel), 0.0, 0.5);
        gtk_label_set_line_wrap(GTK_LABEL(serverMessageDescriptionLabel), TRUE);
#ifdef GTK_API_VERSION_2
        gtk_table_attach_defaults(GTK_TABLE(table), serverMessageDescriptionLabel, 0, 1, 0, 1);
#else
        gtk_grid_attach(GTK_GRID(grid), serverMessageDescriptionLabel, 0, 0, 1, 1);
        gtk_widget_set_hexpand(serverMessageDescriptionLabel, TRUE);
        gtk_widget_set_vexpand(serverMessageDescriptionLabel, TRUE);
#endif
        GtkWidget* serverMessageLabel = gtk_label_new(realm);
        gtk_misc_set_alignment(GTK_MISC(serverMessageLabel), 0.0, 0.5);
        gtk_label_set_line_wrap(GTK_LABEL(serverMessageLabel), TRUE);
#ifdef GTK_API_VERSION_2
        gtk_table_attach_defaults(GTK_TABLE(table), serverMessageLabel, 1, 2, 0, 1);
#else
        gtk_grid_attach(GTK_GRID(grid), serverMessageLabel, 1, 0, 1, 1);
        gtk_widget_set_hexpand(serverMessageLabel, TRUE);
        gtk_widget_set_vexpand(serverMessageLabel, TRUE);
#endif
    }

#ifdef GTK_API_VERSION_2
    m_loginEntry = addEntryToTable(GTK_TABLE(table), hasRealm ? 1 : 0, _("Username:"******"Password:"******"Username:"******"Password:"******"_Remember password"));
        gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_rememberCheckButton))), TRUE);
        gtk_box_pack_start(GTK_BOX(rememberBox), m_rememberCheckButton, FALSE, FALSE, 0);
    }
}