* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; version 2.1 of
- * the License.
+ * the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
/**
* SECTION:hildon-get-password-dialog
- * @short_description: A widget used to get a password
+ * @short_description: A widget used to get a password.
* @see_also: #HildonSetPasswordDialog
*
* HildonGetPasswordDialog prompts the user for a password. It allows
* inputting password, with an optional configurable label eg. for
* showing a custom message. The maximum length of the password can be set.
+ *
+ * <example>
+ * <title>HildonGetPassword example</title>
+ * <programlisting>
+ * get_dialog = HILDON_GET_PASSWORD_DIALOG (hildon_get_password_dialog_new (parent, FALSE));
+ * <!-- -->
+ * gtk_widget_show (GTK_WIDGET (get_dialog));
+ * <!-- -->
+ * i = gtk_dialog_run (GTK_DIALOG (get_dialog));
+ * <!-- -->
+ * pass = hildon_get_password_dialog_get_password (get_dialog);
+ * <!-- -->
+ * if (i == GTK_RESPONSE_OK && (strcmp (pass, dialog.current_password) != 0))
+ * {
+ * gtk_infoprint (GTK_WINDOW (parent), STR_PASSWORD_INCORRECT);
+ * gtk_widget_set_sensitive (GTK_WIDGET (dialog.button2), FALSE);
+ * gtk_widget_set_sensitive (GTK_WIDGET (dialog.button3), FALSE);
+ * gtk_widget_set_sensitive (GTK_WIDGET (dialog.button4), FALSE);
+ * }
+ * <!-- -->
+ * else if (i == GTK_RESPONSE_OK)
+ * {
+ * gtk_widget_set_sensitive( GTK_WIDGET( dialog.button2 ), TRUE);
+ * }
+ * <!-- -->
+ * else
+ * {
+ * gtk_widget_set_sensitive (GTK_WIDGET (dialog.button2), FALSE);
+ * gtk_widget_set_sensitive (GTK_WIDGET (dialog.button3), FALSE);
+ * gtk_widget_set_sensitive (GTK_WIDGET (dialog.button4), FALSE);
+ * }
+ * gtk_widget_destroy (GTK_WIDGET (get_dialog));
+ * }
+ * </programlisting>
+ * </example>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "hildon-get-password-dialog.h"
-#include <glib.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <stdio.h>
-#include <gtk/gtk.h>
-#include "hildon-input-mode-hint.h"
+#include <libintl.h>
+
+#include "hildon-get-password-dialog.h"
#include "hildon-caption.h"
#include "hildon-banner.h"
-#include <libintl.h>
#include "hildon-get-password-dialog-private.h"
#define _(String) dgettext("hildon-libs", String)
static void
create_contents (HildonGetPasswordDialog *dialog);
+#ifdef MAEMO_GTK
static void
invalid_input (GtkWidget *widget,
GtkInvalidInputType reason,
gpointer unused);
+#endif
enum
{
break;
case PROP_NUMBERS_ONLY:
+#ifdef MAEMO_GTK
/* Set input mode for the password entry */
g_object_set(G_OBJECT (gtk_bin_get_child GTK_BIN ((priv->password_entry))),
- "input-mode",
+ "hildon-input-mode",
(g_value_get_boolean (value)
- ? HILDON_INPUT_MODE_HINT_NUMERIC
- : HILDON_INPUT_MODE_HINT_ALPHANUMERICSPECIAL),
+ ? HILDON_GTK_INPUT_MODE_NUMERIC
+ : HILDON_GTK_INPUT_MODE_FULL),
NULL);
+#endif
break;
case PROP_CAPTION_LABEL:
HildonGetPasswordDialogPrivate *priv;
const gchar *string;
gint max_length;
+#ifdef MAEMO_GTK
gint input_mode;
+#endif
priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
g_assert (priv);
break;
case PROP_NUMBERS_ONLY:
+#ifdef MAEMO_GTK
/* This property is set if and only if the input mode
of the password entry has been set to numeric only */
g_object_get (G_OBJECT (gtk_bin_get_child (GTK_BIN (priv->password_entry))),
- "input-mode", &input_mode, NULL);
+ "hildon-input-mode", &input_mode, NULL);
g_value_set_boolean (value,
- (input_mode == HILDON_INPUT_MODE_HINT_NUMERIC));
+ (input_mode == HILDON_GTK_INPUT_MODE_NUMERIC));
+#else
+ g_value_set_boolean (value, FALSE);
+#endif
break;
case PROP_CAPTION_LABEL:
HildonGetPasswordDialogPrivate *priv;
GtkSizeGroup * group;
GtkWidget *control;
+ AtkObject *atk_aux = NULL;
/* Cache private pointer for faster member access */
priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
/* Create password text entry */
control = gtk_entry_new ();
+ if ((atk_aux = gtk_widget_get_accessible(control)))
+ {
+ atk_object_set_name(atk_aux, _("Passwd"));
+ }
+
gtk_entry_set_width_chars (GTK_ENTRY (control), 20);
+#ifdef MAEMO_GTK
g_object_set (control, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL);
+#endif
gtk_entry_set_visibility (GTK_ENTRY(control), FALSE);
priv->password_entry = HILDON_CAPTION
* @parent: parent window; can be NULL
* @password: a default password to be shown in password field
* @get_old: FALSE creates a new get password dialog and
- * TRUE creates a new get old password dialog.That is,
+ * TRUE creates a new get old password dialog. That is,
* if the password to be obtained is the old password,
* this parameter is specified TRUE.
*
* @dialog: the dialog
* @max_characters: the maximum number of characters the password dialog
* accepts
- * @new_caption: the text to be set as the caption label
*
* sets the maximum number of characters allowed as the password
*/
* disconnected before connecting the new signal. Besides, this
* should go into the constructor */
+#ifdef MAEMO_GTK
/* Connect callback to show error banner if the limit is exceeded */
g_signal_connect (GTK_ENTRY
(gtk_bin_get_child
G_CALLBACK (invalid_input),
NULL
);
+#endif
}
+#ifdef MAEMO_GTK
/* Callback that gets called when maximum chars is reached in the entry */
static void
invalid_input (GtkWidget *widget,
hildon_banner_show_information (widget, NULL, _(HILDON_GET_PASSWORD_DIALOG_MAX_CHARS));
}
}
+#endif