From: Michael Dominic Kostrzewa Date: Tue, 6 Feb 2007 14:15:16 +0000 (+0000) Subject: Adding examples for password dialogs. Doc fix. Do not show the username as a hidden... X-Git-Tag: 2.1.66-1~958 X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;h=693f9bbbbd5d40f3cd4f03da06ceb36973950008;p=hildon Adding examples for password dialogs. Doc fix. Do not show the username as a hidden field. --- diff --git a/ChangeLog.2 b/ChangeLog.2 index 376272a..9d5e140 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -1,5 +1,17 @@ 2007-02-06 Michael Dominic Kostrzewa + * examples/Makefile.am: + * examples/hildon-get-password-dialog-example.c: + * examples/hildon-login-dialog-example.c: + * examples/hildon-set-password-dialog-example.c: Adding examples for + password dialogs. + + * src/hildon-get-password-dialog.c: Doc fix. + + * src/hildon-login-dialog.c: Do not show the username as hidden field. + +2007-02-06 Michael Dominic Kostrzewa + * HACKING: Adding a HACKING file with some basic rules of styling and code formatting. diff --git a/examples/Makefile.am b/examples/Makefile.am index 97b4add..1cc760b 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,20 +1,22 @@ MAINTAINERCLEANFILES = Makefile.in if BUILD_EXAMPLES -noinst_PROGRAMS = hildon-window-example \ - hildon-banner-example \ - hildon-caption-example \ - hildon-weekday-picker-example \ - hildon-sort-dialog-example \ - hildon-controlbar-example \ - hildon-note-example \ - hildon-time-picker-example \ - hildon-color-chooser-example \ - hildon-color-button-example \ - hildon-login-dialog-example \ - hildon-time-editor-example \ - hildon-icon-sizes-example \ - hildon-insensitive-example +noinst_PROGRAMS = hildon-window-example \ + hildon-banner-example \ + hildon-caption-example \ + hildon-weekday-picker-example \ + hildon-sort-dialog-example \ + hildon-controlbar-example \ + hildon-note-example \ + hildon-time-picker-example \ + hildon-color-chooser-example \ + hildon-color-button-example \ + hildon-login-dialog-example \ + hildon-time-editor-example \ + hildon-icon-sizes-example \ + hildon-insensitive-example \ + hildon-get-password-dialog-example \ + hildon-set-password-dialog-example # HIldon window hildon_window_example_LDADD = $(HILDON_OBJ_LIBS) @@ -86,5 +88,14 @@ hildon_insensitive_example_LDADD = $(HILDON_OBJ_LIBS) hildon_insensitive_example_CFLAGS = $(HILDON_OBJ_CFLAGS) hildon_insensitive_example_SOURCES = hildon-insensitive-example.c +# HIldon get password dialog example +hildon_get_password_dialog_example_LDADD = $(HILDON_OBJ_LIBS) +hildon_get_password_dialog_example_CFLAGS = $(HILDON_OBJ_CFLAGS) +hildon_get_password_dialog_example_SOURCES = hildon-get-password-dialog-example.c + +# HIldon set password dialog example +hildon_set_password_dialog_example_LDADD = $(HILDON_OBJ_LIBS) +hildon_set_password_dialog_example_CFLAGS = $(HILDON_OBJ_CFLAGS) +hildon_set_password_dialog_example_SOURCES = hildon-set-password-dialog-example.c endif diff --git a/examples/hildon-get-password-dialog-example.c b/examples/hildon-get-password-dialog-example.c new file mode 100644 index 0000000..7d01ec8 --- /dev/null +++ b/examples/hildon-get-password-dialog-example.c @@ -0,0 +1,49 @@ +/* + * This file is a part of hildon examples + * + * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. + * + * Author: Michael Dominic Kostrzewa + * + * 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. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include "hildon.h" + +int +main (int argc, + char **args) +{ + gtk_init (&argc, &args); + + GtkDialog *dialog = GTK_DIALOG (hildon_get_password_dialog_new (NULL, TRUE)); + + hildon_get_password_dialog_set_message ((HildonGetPasswordDialog *) dialog, "Enter secret password"); + + gtk_widget_show_all (GTK_WIDGET (dialog)); + gtk_dialog_run (dialog); + + g_debug ("Password: %s", hildon_get_password_dialog_get_password ((HildonGetPasswordDialog *) dialog)); + + return 0; +} + + diff --git a/examples/hildon-login-dialog-example.c b/examples/hildon-login-dialog-example.c index 70ae32b..1d43c16 100644 --- a/examples/hildon-login-dialog-example.c +++ b/examples/hildon-login-dialog-example.c @@ -29,7 +29,8 @@ #include "hildon.h" int -main (int argc, char **args) +main (int argc, + char **args) { gtk_init (&argc, &args); @@ -37,9 +38,11 @@ main (int argc, char **args) hildon_login_dialog_set_message ((HildonLoginDialog *) dialog, "Enter password to login"); - gtk_widget_show_all (GTK_WIDGET (dialog)); gtk_dialog_run (dialog); + + g_debug ("Password: %s", hildon_login_dialog_get_password ((HildonLoginDialog *) dialog)); + g_debug ("Username: %s", hildon_login_dialog_get_username ((HildonLoginDialog *) dialog)); return 0; } diff --git a/examples/hildon-set-password-dialog-example.c b/examples/hildon-set-password-dialog-example.c new file mode 100644 index 0000000..47459de --- /dev/null +++ b/examples/hildon-set-password-dialog-example.c @@ -0,0 +1,49 @@ +/* + * This file is a part of hildon examples + * + * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. + * + * Author: Michael Dominic Kostrzewa + * + * 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. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include "hildon.h" + +int +main (int argc, + char **args) +{ + gtk_init (&argc, &args); + + GtkDialog *dialog = GTK_DIALOG (hildon_set_password_dialog_new (NULL, TRUE)); + + hildon_set_password_dialog_set_message ((HildonSetPasswordDialog *) dialog, "Enter new password"); + + gtk_widget_show_all (GTK_WIDGET (dialog)); + gtk_dialog_run (dialog); + + g_debug ("Password: %s", hildon_set_password_dialog_get_password ((HildonSetPasswordDialog *) dialog)); + + return 0; +} + + diff --git a/src/hildon-get-password-dialog.c b/src/hildon-get-password-dialog.c index ae669cc..2601258 100644 --- a/src/hildon-get-password-dialog.c +++ b/src/hildon-get-password-dialog.c @@ -500,7 +500,7 @@ hildon_get_password_dialog_new (GtkWindow *parent, * @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. * diff --git a/src/hildon-login-dialog.c b/src/hildon-login-dialog.c index cdd3d7e..a53a9a2 100644 --- a/src/hildon-login-dialog.c +++ b/src/hildon-login-dialog.c @@ -275,7 +275,6 @@ hildon_login_dialog_init (HildonLoginDialog *dialog) /* Setup username entry */ priv->username_entry = GTK_ENTRY (gtk_entry_new ()); g_object_set (priv->username_entry, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL); - gtk_entry_set_visibility (GTK_ENTRY (priv->username_entry), FALSE); caption = HILDON_CAPTION (hildon_caption_new (group,