2 * This file is a part of hildon
4 * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
6 * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; version 2.1 of
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 * SECTION:hildon-set-password-dialog
27 * @short_description: A dialog used to set, change or remove a password.
28 * @see_also: #HildonGetPasswordDialog
30 * HildonSetPasswordDialog allows setting and changing a password.
32 * In Change mode: Dialog is used to change or remove an existing
33 * password. Unselecting the check box dims the password fields below
34 * it. If the dialog is accepted with 'OK' while the check box is
35 * unselected, a Confirmation Note is shown. If the Confirmation Note
36 * Dialog is accepted with 'Remove', the password protection is removed.
38 * In Set mode: Set Password Dialog is used to define a password, or
39 * change a password that cannot be removed.
46 #include "hildon-set-password-dialog.h"
47 #include <gdk/gdkkeysyms.h>
55 #include "hildon-caption.h"
56 #include "hildon-note.h"
57 #include "hildon-defines.h"
58 #include "hildon-banner.h"
60 #include "hildon-set-password-dialog-private.h"
62 #define HILDON_SET_PASSWORD_DIALOG_TITLE "ecdg_ti_set_password"
64 #define HILDON_SET_PASSWORD_DIALOG_PASSWORD "ecdg_fi_set_passwd_enter_pwd"
66 #define HILDON_SET_PASSWORD_DIALOG_VERIFY_PASSWORD "ecdg_fi_set_passwd_confirm"
68 #define HILDON_SET_PASSWORD_DIALOG_OK "ecdg_bd_set_password_dialog_ok"
70 #define HILDON_SET_PASSWORD_DIALOG_CANCEL "ecdg_bd_set_password_dialog_cancel"
72 #define HILDON_SET_MODIFY_PASSWORD_DIALOG_TITLE "ckdg_ti_dialog_c_passwd_change_password"
74 #define HILDON_SET_MODIFY_PASSWORD_DIALOG_LABEL "ckdg_fi_dialog_c_passwd_pwd_protect"
76 #define HILDON_SET_MODIFY_PASSWORD_DIALOG_PASSWORD "ckdg_fi_dialog_c_passwd_new_pwd"
78 #define HILDON_SET_MODIFY_PASSWORD_DIALOG_VERIFY_PASSWORD "ckdg_fi_dialog_c_passwd_ver_pwd"
80 #define HILDON_SET_MODIFY_PASSWORD_DIALOG_OK "ckdg_bd_change_password_dialog_ok"
82 #define HILDON_SET_MODIFY_PASSWORD_DIALOG_CANCEL "ckdg_bd_change_password_dialog_cancel"
84 #define HILDON_SET_PASSWORD_DIALOG_MISMATCH "ecdg_ib_passwords_do_not_match"
86 #define HILDON_SET_PASSWORD_DIALOG_EMPTY "ecdg_ib_password_is_empty"
88 #define HILDON_SET_PASSWORD_DIALOG_REMOVE_PROTECTION "ckdg_nc_dialog_c_passwd_remove_pwd"
90 #define HILDON_REMOVE_PROTECTION_CONFIRMATION_REMOVE "ckdg_bd_dialog_c_passwd_remove_button"
92 #define HILDON_REMOVE_PROTECTION_CONFIRMATION_CANCEL "ckdg_bd_dialog_c_passwd_cancel_button"
94 #define _(String) dgettext("hildon-libs", String)
96 #define c_(String) dgettext("hildon-common-strings", String)
98 static GtkDialogClass* parent_class;
101 hildon_set_password_dialog_class_init (HildonSetPasswordDialogClass *class);
104 hildon_set_password_dialog_init (HildonSetPasswordDialog *dialog);
107 hildon_checkbox_toggled (GtkWidget *widget,
111 hildon_set_password_response_change (GtkDialog *d,
116 hildon_set_password_response_set (GtkDialog * d,
121 create_contents (HildonSetPasswordDialog *dialog);
124 hildon_set_password_set_property (GObject *object,
130 hildon_set_password_get_property (GObject *object,
140 PROP_HILDON_PASSWORD_DIALOG
144 hildon_set_password_set_property (GObject *object,
149 HildonSetPasswordDialog *dialog = HILDON_SET_PASSWORD_DIALOG (object);
150 HildonSetPasswordDialogPrivate *priv;
152 priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
158 /* Update domain label to display new value */
159 gtk_label_set_text (priv->message_label, g_value_get_string (value));
163 /* Update password entry to display new value */
164 gtk_entry_set_text (GTK_ENTRY (priv->pwd1st_entry), g_value_get_string (value));
167 case PROP_HILDON_PASSWORD_DIALOG:
168 /* Note this is a G_PARAM_CONSTRUCT_ONLY type property */
169 priv->protection = g_value_get_boolean (value);
171 /* We now have the necessary information to populate the dialog */
172 /* FIXME It looks kinda extremally bad that this is here...
173 * what about situations where this prop is NOT set during
175 create_contents (dialog);
179 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
185 hildon_set_password_get_property (GObject *object,
190 HildonSetPasswordDialogPrivate *priv = NULL;
192 priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (object);
198 g_value_set_string (value, gtk_label_get_text (priv->message_label));
202 g_value_set_string (value,
203 gtk_entry_get_text (GTK_ENTRY (priv->pwd1st_entry)));
206 case PROP_HILDON_PASSWORD_DIALOG:
207 g_value_set_boolean (value, priv->protection);
211 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
218 create_contents (HildonSetPasswordDialog *dialog)
220 HildonSetPasswordDialogPrivate *priv = NULL;
224 priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
226 priv->checkbox = NULL;
228 /* Size group for labels */
229 group = GTK_SIZE_GROUP (gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL));
231 gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
233 /* Setup and pack domain label */
234 priv->message_label = GTK_LABEL (gtk_label_new (NULL));
235 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
236 GTK_WIDGET(priv->message_label), FALSE, FALSE, 0);
237 gtk_widget_show (GTK_WIDGET (priv->message_label));
239 if (priv->protection == TRUE) {
240 /* Use Change Password Dialog strings */
241 priv->pwd1st_caption_string = _(HILDON_SET_MODIFY_PASSWORD_DIALOG_PASSWORD);
242 priv->pwd2nd_caption_string = _(HILDON_SET_MODIFY_PASSWORD_DIALOG_VERIFY_PASSWORD);
244 /* Setup checkbox to enable/disable password protection */
245 priv->checkbox = gtk_check_button_new ();
246 gtk_widget_show (priv->checkbox);
247 priv->checkbox_caption = hildon_caption_new
249 _(HILDON_SET_MODIFY_PASSWORD_DIALOG_LABEL),
251 NULL, HILDON_CAPTION_OPTIONAL);
252 hildon_caption_set_separator (HILDON_CAPTION (priv->checkbox_caption), "");
253 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
254 priv->checkbox_caption, TRUE, TRUE, 0);
255 gtk_widget_show (priv->checkbox_caption);
256 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->checkbox),
258 gtk_signal_connect (GTK_OBJECT (priv->checkbox), "toggled",
259 G_CALLBACK (hildon_checkbox_toggled), dialog);
261 /* Setup appropriate response handler */
262 g_signal_connect (G_OBJECT (dialog), "response",
263 G_CALLBACK (hildon_set_password_response_change),
266 /* Use Set Password Dialog strings */
267 priv->pwd1st_caption_string = _(HILDON_SET_PASSWORD_DIALOG_PASSWORD);
268 priv->pwd2nd_caption_string = _(HILDON_SET_PASSWORD_DIALOG_VERIFY_PASSWORD);
270 /* Setup appropriate response handler */
271 g_signal_connect (G_OBJECT (dialog), "response",
272 G_CALLBACK(hildon_set_password_response_set),
276 /* Create the password field */
277 priv->pwd1st_entry = gtk_entry_new ();
278 g_object_set (priv->pwd1st_entry, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL);
279 gtk_entry_set_visibility (GTK_ENTRY(priv->pwd1st_entry), FALSE);
280 gtk_widget_show (priv->pwd1st_entry);
281 priv->pwd1st_caption = hildon_caption_new (group,
282 priv->pwd1st_caption_string,
284 NULL, HILDON_CAPTION_OPTIONAL);
286 hildon_caption_set_separator (HILDON_CAPTION(priv->pwd1st_caption), "");
287 gtk_entry_set_visibility (GTK_ENTRY (priv->pwd1st_entry), FALSE);
288 gtk_box_pack_start (GTK_BOX(GTK_DIALOG (dialog)->vbox),
289 priv->pwd1st_caption, TRUE, TRUE, 0);
290 gtk_widget_show (priv->pwd1st_caption);
292 /* Create the password verify field */
293 priv->pwd2nd_entry = gtk_entry_new();
294 g_object_set (priv->pwd2nd_entry, "hildon-input-mode", HILDON_GTK_INPUT_MODE_FULL, NULL);
295 gtk_widget_show (priv->pwd2nd_entry);
296 priv->pwd2nd_caption = hildon_caption_new (group,
297 priv->pwd2nd_caption_string,
299 NULL, HILDON_CAPTION_OPTIONAL);
300 hildon_caption_set_separator (HILDON_CAPTION (priv->pwd2nd_caption), "");
301 gtk_entry_set_visibility (GTK_ENTRY (priv->pwd2nd_entry), FALSE);
302 gtk_box_pack_start (GTK_BOX(GTK_DIALOG (dialog)->vbox),
303 priv->pwd2nd_caption, TRUE, TRUE, 0);
304 gtk_widget_show (priv->pwd2nd_caption);
306 /* Set dialog title */
307 gtk_window_set_title (GTK_WINDOW (dialog),
309 ? HILDON_SET_MODIFY_PASSWORD_DIALOG_TITLE
310 : HILDON_SET_PASSWORD_DIALOG_TITLE));
312 /* Create the OK/CANCEL buttons */
313 gtk_dialog_add_button (GTK_DIALOG (dialog), _(priv->protection
314 ? HILDON_SET_MODIFY_PASSWORD_DIALOG_OK
315 : HILDON_SET_PASSWORD_DIALOG_OK), GTK_RESPONSE_OK);
317 gtk_dialog_add_button (GTK_DIALOG (dialog), _(priv->protection
318 ? HILDON_SET_MODIFY_PASSWORD_DIALOG_CANCEL
319 : HILDON_SET_PASSWORD_DIALOG_CANCEL), GTK_RESPONSE_CANCEL);
321 gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
322 gtk_widget_show_all (GTK_DIALOG (dialog)->action_area);
324 /* Ensure group is freed when all its contents have been removed */
325 g_object_unref (group);
329 hildon_set_password_dialog_class_init (HildonSetPasswordDialogClass *class)
331 GObjectClass *object_class = G_OBJECT_CLASS (class);
333 parent_class = g_type_class_peek_parent (class);
335 /* Override virtual methods */
336 object_class->set_property = hildon_set_password_set_property;
337 object_class->get_property = hildon_set_password_get_property;
339 /* Install new properties */
340 g_object_class_install_property (object_class,
342 g_param_spec_string ("message",
344 "A message to display to the user",
349 * HildonSetPasswordDialog:modify-protection:
353 g_object_class_install_property (object_class,
354 PROP_HILDON_PASSWORD_DIALOG,
355 g_param_spec_boolean ("modify-protection",
357 "Set type to dialog",
359 G_PARAM_CONSTRUCT_ONLY |
363 * HildonSetPasswordDialog:password:
365 * Content of the password field.
367 g_object_class_install_property (object_class,
369 g_param_spec_string ("password",
371 "Set content to dialog",
375 /* Install private structure */
376 g_type_class_add_private (class,
377 sizeof (HildonSetPasswordDialogPrivate));
381 hildon_set_password_dialog_init (HildonSetPasswordDialog *dialog)
383 /* Most of the initializations are done in create_contents()
384 after the 'modify_protection' property has been set */
386 gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
390 /* We come here when response button is clicked and dialog
391 is used to change existing password. */
393 hildon_set_password_response_change (GtkDialog *dialog,
397 GtkEntry *pwd1st_entry;
398 GtkEntry *pwd2nd_entry;
403 HildonSetPasswordDialogPrivate *priv;
405 priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
408 /* Password and verification */
409 pwd1st_entry = GTK_ENTRY (gtk_bin_get_child
410 (GTK_BIN (priv->pwd1st_caption)));
411 pwd2nd_entry = GTK_ENTRY (gtk_bin_get_child
412 (GTK_BIN (priv->pwd2nd_caption)));
413 text1 = GTK_ENTRY (pwd1st_entry)->text;
414 text2 = GTK_ENTRY (pwd2nd_entry)->text;
416 /* User accepted the dialog */
417 if (arg1 == GTK_RESPONSE_OK) {
418 /* Is the checkbox marked, so password protection is still in use? */
419 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->checkbox))){
420 /* Yes, Something is given as password as well? */
421 if (text1[0] != '\0') {
422 if (strcmp (text1, text2) == 0) {
423 /* Passwords match, so accept change password */
424 priv->protection = TRUE;
426 } else if (text2[0] == '\0') {
427 /* Second field is empty, so show error, but don't clear fields */
428 g_signal_stop_emission_by_name (G_OBJECT(dialog),
431 hildon_banner_show_information (GTK_WIDGET (dialog), NULL,
432 c_(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
434 gtk_widget_grab_focus (GTK_WIDGET (pwd2nd_entry));
437 /* Error: Passwords don't match, so start over */
438 g_signal_stop_emission_by_name (G_OBJECT(dialog),
441 gtk_entry_set_text (pwd1st_entry, "");
442 gtk_entry_set_text (pwd2nd_entry, "");
444 hildon_banner_show_information (GTK_WIDGET (dialog), NULL,
445 c_(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
447 gtk_widget_grab_focus (GTK_WIDGET (pwd1st_entry));
450 /* No, the password is empty */
451 g_signal_stop_emission_by_name (G_OBJECT (dialog), "response");
453 if (text2[0] == '\0') {
454 /* Error: Both fields are empty */
455 hildon_banner_show_information (GTK_WIDGET (dialog), NULL, c_(HILDON_SET_PASSWORD_DIALOG_EMPTY));
457 /* Error: Second field doesn't match
458 the empty first field, so start over */
459 hildon_banner_show_information (GTK_WIDGET (dialog), NULL, c_(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
460 gtk_entry_set_text(pwd2nd_entry, "");
463 gtk_widget_grab_focus (GTK_WIDGET (pwd1st_entry));
466 /* No, user wants to remove password protection.
467 Confirm remove password protection */
468 note = HILDON_NOTE (hildon_note_new_confirmation
469 (GTK_WINDOW (dialog),
470 c_(HILDON_SET_PASSWORD_DIALOG_REMOVE_PROTECTION)));
472 hildon_note_set_button_texts
474 c_(HILDON_REMOVE_PROTECTION_CONFIRMATION_REMOVE),
475 c_(HILDON_REMOVE_PROTECTION_CONFIRMATION_CANCEL));
477 /* Display confirmation note */
478 i = gtk_dialog_run (GTK_DIALOG (note));
480 gtk_widget_destroy (GTK_WIDGET (note));
482 if (i == GTK_RESPONSE_OK)
483 /* Remove password protection */
484 priv->protection = FALSE;
486 /* Remove password protection cancelled */
487 priv->protection = TRUE;
488 g_signal_stop_emission_by_name (G_OBJECT(dialog), "response");
493 /* Watch out for fading boolean values */
494 priv->protection = TRUE;
498 /* We come here when response button is clicked and dialog
499 is used to set new password. */
501 hildon_set_password_response_set (GtkDialog *dialog,
505 GtkEntry *pwd1st_entry;
506 GtkEntry *pwd2nd_entry;
510 HildonSetPasswordDialogPrivate *priv;
512 priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
515 /* Password and confirmation */
516 pwd1st_entry = GTK_ENTRY (gtk_bin_get_child
517 (GTK_BIN (priv->pwd1st_caption)));
519 pwd2nd_entry = GTK_ENTRY (gtk_bin_get_child
520 (GTK_BIN (priv->pwd2nd_caption)));
522 text1 = GTK_ENTRY (pwd1st_entry)->text;
523 text2 = GTK_ENTRY (pwd2nd_entry)->text;
525 if (arg1 == GTK_RESPONSE_OK) {
526 /* User provided something for password? */
527 if (text1[0] != '\0') {
528 if (strcmp (text1, text2) == 0) {
529 /* Passwords match, so accept set password */
530 priv->protection = TRUE;
532 } else if (text2[0] == '\0') {
533 /* Second field is empty, so show error,
534 but don't clear the fields */
535 g_signal_stop_emission_by_name (G_OBJECT(dialog), "response");
536 hildon_banner_show_information (GTK_WIDGET (dialog), NULL, c_(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
538 gtk_widget_grab_focus (GTK_WIDGET (priv->pwd2nd_entry));
541 /* Error: Passwords don't match, so start over */
542 g_signal_stop_emission_by_name (G_OBJECT(dialog), "response");
543 gtk_entry_set_text (pwd1st_entry, "");
544 gtk_entry_set_text (pwd2nd_entry, "");
545 hildon_banner_show_information (GTK_WIDGET (dialog), NULL, c_(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
547 gtk_widget_grab_focus (GTK_WIDGET (priv->pwd1st_entry));
550 /* First field is empty */
551 g_signal_stop_emission_by_name (G_OBJECT (dialog), "response");
552 if (text2[0] == '\0') {
553 /* Error: Both fields are empty */
554 hildon_banner_show_information (GTK_WIDGET (dialog), NULL, c_(HILDON_SET_PASSWORD_DIALOG_EMPTY));
556 /* Error: Second field doesn't match
557 the empty first field, so start over */
558 hildon_banner_show_information (GTK_WIDGET (dialog), NULL, c_(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
559 gtk_entry_set_text (pwd2nd_entry, "");
562 gtk_widget_grab_focus (GTK_WIDGET (pwd1st_entry));
565 /* Watch out for fading boolean values */
566 priv->protection = FALSE;
571 hildon_checkbox_toggled (GtkWidget *widget,
574 HildonSetPasswordDialogPrivate *priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
579 /* If the user enabled/disabled the password protection feature
580 we enable/disable password entries accordingly */
581 active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
582 gtk_widget_set_sensitive (GTK_WIDGET (priv->pwd1st_entry), active);
583 gtk_widget_set_sensitive (GTK_WIDGET (priv->pwd2nd_entry), active);
587 * hildon_set_password_dialog_get_type:
589 * Returns GType for HildonPasswordDialog as produced by
590 * g_type_register_static().
592 * Returns: HildonSetPasswordDialog type
595 hildon_set_password_dialog_get_type (void)
597 static GType dialog_type = 0;
600 static const GTypeInfo dialog_info = {
601 sizeof (HildonSetPasswordDialogClass),
602 NULL, /* base_init */
603 NULL, /* base_finalize */
604 (GClassInitFunc) hildon_set_password_dialog_class_init,
605 NULL, /* class_finalize */
606 NULL, /* class_data */
607 sizeof (HildonSetPasswordDialog),
609 (GInstanceInitFunc) hildon_set_password_dialog_init
612 dialog_type = g_type_register_static (GTK_TYPE_DIALOG,
613 "HildonSetPasswordDialog",
621 * hildon_set_password_dialog_new:
622 * @parent: parent window; can be NULL
623 * @modify_protection: TRUE creates a new change password dialog and FALSE
624 * creates a new set password dialog
626 * Constructs a new HildonSetPasswordDialog.
628 * Returns: a new #GtkWidget of type HildonSetPasswordDialog
631 hildon_set_password_dialog_new (GtkWindow *parent,
632 gboolean modify_protection)
634 return hildon_set_password_dialog_new_with_default (parent, "", modify_protection);
638 * hildon_set_password_dialog_new_with_default:
639 * @parent: parent window; can be NULL
640 * @password: a default password to be shown in password field
641 * @modify_protection: TRUE creates a new change password dialog and FALSE
642 * creates a new set password dialog
644 * Same as #hildon_set_password_dialog_new, but with a default password
647 * Returns: a new #GtkWidget of type HildonSetPasswordDialog
651 hildon_set_password_dialog_new_with_default (GtkWindow *parent,
652 const gchar *password,
653 gboolean modify_protection)
655 GtkWidget *dialog = g_object_new (HILDON_TYPE_SET_PASSWORD_DIALOG,
656 "modify_protection", modify_protection,
657 "password", password, NULL);
659 if (parent != NULL) {
660 gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
667 * hildon_set_password_dialog_get_password:
668 * @dialog: pointer to HildonSetPasswordDialog
670 * Returns current password.
672 * Returns: changed password ( if the dialog is successfully
673 * accepted with 'OK' ( and when the check box is 'ON' ( in Change Password
677 hildon_set_password_dialog_get_password (HildonSetPasswordDialog *dialog)
679 HildonSetPasswordDialogPrivate *priv;
681 g_return_val_if_fail (HILDON_IS_SET_PASSWORD_DIALOG (dialog), NULL);
683 priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
686 return GTK_ENTRY (priv->pwd1st_entry)->text;
690 * hildon_set_password_dialog_get_protected:
691 * @dialog: pointer to HildonSetPasswordDialog
693 * Returns the protection mode.
695 * Returns: password protection mode ( TRUE when the protection is
696 * 'ON' and FALSE when the protection is 'OFF' )
699 hildon_set_password_dialog_get_protected (HildonSetPasswordDialog *dialog)
701 HildonSetPasswordDialogPrivate *priv;
703 g_return_val_if_fail (HILDON_IS_SET_PASSWORD_DIALOG (dialog), FALSE);
705 priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
708 return priv->protection;
712 * hildon_set_password_dialog_set_message:
713 * @dialog: the dialog
714 * @message: the message or some other descriptive text to be set
716 * Sets the optional descriptive text.
719 hildon_set_password_dialog_set_message (HildonSetPasswordDialog *dialog,
720 const gchar *message)
722 HildonSetPasswordDialogPrivate *priv = NULL;
724 g_return_if_fail (HILDON_IS_SET_PASSWORD_DIALOG (dialog));
726 priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE (dialog);
729 gtk_label_set_text (priv->message_label, message);