2009-03-24 Alberto Garcia <agarcia@igalia.com>
[hildon] / src / hildon-note.c
index 1d7df3f..061220b 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
  *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ * Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * SECTION:hildon-note
  * @short_description: A widget to ask confirmation from the user.
  *
- * Notes are used to for confirmation (OK/Cancel/etc.) from the user.
- * A simple note contains an information text. Additional features
- * such as progress bars or animation can also be included.
- * 
+ * #HildonNote is a convenient way to prompt users for a small amount of
+ * input. A simple note contains an information text and, in case of
+ * confirmation notes, it shows buttons to confirm or cancel. It also can
+ * include a progress bar.
+ *
+ * This widget provides convenient functions to create either
+ * information notes, confirmation notes or cancel notes, which are
+ * useful to show the progress of a requested task allowing the user
+ * to cancel it.
+ *
+ * To create information notes you can use
+ * hildon_note_new_information(). hildon_note_new_confirmation()
+ * creates a note with a text and two buttons to confirm or
+ * cancel. Note that it is possible to create a confirmation note with
+ * customized buttons by using
+ * hildon_note_new_confirmation_add_buttons().
+ *
+ * To create a note with a text, a progress bar and cancel button,
+ * hildon_note_new_cancel_with_progress_bar() can be used.
+ *
  * <example>
  * <title>HildonNote example</title>
  * <programlisting>
 #include                                        <config.h>
 #endif
 
-#include                                        "hildon-note.h"
-#include                                        <gtk/gtklabel.h>
-#include                                        <gtk/gtkimage.h>
-#include                                        <gtk/gtkhbox.h>
-#include                                        <gtk/gtkalignment.h>
-#include                                        <gtk/gtkvbox.h>
-#include                                        <gtk/gtkbutton.h>
+#include                                        <stdio.h>
+#include                                        <string.h>
 #include                                        <libintl.h>
+#include                                        <X11/X.h>
+#include                                        <X11/Xatom.h>
+#include                                        <gdk/gdkx.h>
+
+#undef HILDON_DISABLE_DEPRECATED
+
+#include                                        "hildon-note.h"
 #include                                        "hildon-defines.h"
 #include                                        "hildon-sound.h"
 #include                                        "hildon-banner.h" 
 #include                                        "hildon-enum-types.h"
-#include                                        <stdio.h>
-#include                                        <string.h>
-#include                                        <X11/X.h>
-#include                                        <X11/Xatom.h>
 #include                                        "hildon-note-private.h"
 
+#define                                         HILDON_INFORMATION_NOTE_MIN_HEIGHT 140
+
+#define                                         HILDON_INFORMATION_NOTE_MARGIN 100
+
 #define                                         CONFIRMATION_SOUND_PATH \
                                                 "/usr/share/sounds/ui-confirmation_note.wav"
 
 #define                                         INFORMATION_SOUND_PATH \
                                                 "/usr/share/sounds/ui-information_note.wav"
 
-#define                                         HILDON_NOTE_CONFIRMATION_ICON \
-                                                "qgn_note_confirm"
-
-#define                                         HILDON_NOTE_INFORMATION_ICON \
-                                                "qgn_note_info"
-
 #define                                         _(String) dgettext("hildon-libs", String)
 
 static void 
@@ -102,20 +114,21 @@ static void
 hildon_note_rebuild                             (HildonNote *note);
 
 static void
-hildon_note_finalize                            (GObject *obj_self);
+hildon_note_rename                              (HildonNote *note);
 
-static gboolean
-hildon_note_button_release                      (GtkWidget *widget,
-                                                 GdkEventButton *event);
+static void
+hildon_note_finalize                            (GObject *obj_self);
 
 static void
-hildon_note_map                                 (GtkWidget *widget);
+hildon_note_realize                             (GtkWidget *widget);
 
 static void
-hildon_note_unmap                               (GtkWidget *widget);
+hildon_note_unrealize                           (GtkWidget *widget);
 
 static void
-hildon_note_realize                             (GtkWidget *widget);
+label_size_request                              (GtkWidget      *label,
+                                                 GtkRequisition *req,
+                                                 GtkWidget      *note);
 
 static void 
 hildon_note_set_property                        (GObject *object,
@@ -146,31 +159,20 @@ enum
 
 static GtkDialogClass*                          parent_class;
 
-static GdkWindow *
-grab_transfer_window_get                        (GtkWidget *widget)
+static gboolean
+event_box_press_event                           (GtkEventBox    *event_box,
+                                                 GdkEventButton *event,
+                                                 GtkDialog      *note)
 {
-    GdkWindow *window;
-    GdkWindowAttr attributes;
-    gint attributes_mask;
-
-    attributes.x = 0;
-    attributes.y = 0;
-    attributes.width = 10;
-    attributes.height = 10;
-    attributes.window_type = GDK_WINDOW_TEMP;
-    attributes.wclass = GDK_INPUT_ONLY;
-    attributes.override_redirect = TRUE;
-    attributes.event_mask = 0;
-
-    attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR;
-
-    window = gdk_window_new (gtk_widget_get_root_window (widget),
-                             &attributes, attributes_mask);
-    gdk_window_set_user_data (window, widget);
+    HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (note);
 
-    gdk_window_show (window);
-
-    return window;
+    if (priv->note_n == HILDON_NOTE_TYPE_INFORMATION ||
+        priv->note_n == HILDON_NOTE_TYPE_INFORMATION_THEME) {
+            gtk_dialog_response (note, GTK_RESPONSE_DELETE_EVENT);
+            return TRUE;
+    } else {
+            return FALSE;
+    }
 }
 
 static void
@@ -190,6 +192,7 @@ hildon_note_set_property                        (GObject *object,
 
         case PROP_HILDON_NOTE_TYPE:
             priv->note_n = g_value_get_enum (value);
+           hildon_note_rename (note);
             hildon_note_rebuild (note);
             break;
 
@@ -204,13 +207,17 @@ hildon_note_set_property                        (GObject *object,
             break;
 
         case PROP_HILDON_NOTE_ICON:
-            gtk_image_set_from_icon_name (GTK_IMAGE (priv->icon), 
-                    g_value_get_string(value), HILDON_ICON_SIZE_BIG_NOTE);
+            if (priv->icon) {
+              g_free (priv->icon);
+            }
+            priv->icon = g_value_dup_string (value);
             break;
 
         case PROP_HILDON_NOTE_STOCK_ICON:
-            gtk_image_set_from_stock (GTK_IMAGE (priv->icon), 
-                    g_value_get_string (value), HILDON_ICON_SIZE_BIG_NOTE);
+            if (priv->stock_icon) {
+              g_free (priv->stock_icon);
+            }
+            priv->stock_icon = g_value_dup_string (value);
             break;
 
         case PROP_HILDON_NOTE_PROGRESSBAR:
@@ -260,11 +267,11 @@ hildon_note_get_property                        (GObject *object,
             break;
 
         case PROP_HILDON_NOTE_ICON:
-            g_object_get_property (G_OBJECT (priv->icon), "icon-name", value);
+            g_value_set_string (value, priv->icon);
             break;
 
         case PROP_HILDON_NOTE_STOCK_ICON:
-            g_object_get_property (G_OBJECT (priv->icon), "stock", value);
+            g_value_set_string (value, priv->stock_icon);
             break;
 
         case PROP_HILDON_NOTE_PROGRESSBAR:
@@ -322,10 +329,8 @@ hildon_note_class_init                          (HildonNoteClass *class)
     object_class->finalize      = hildon_note_finalize;
     object_class->set_property  = hildon_note_set_property;
     object_class->get_property  = hildon_note_get_property;
-    widget_class->button_release_event = hildon_note_button_release;
-    widget_class->map           = hildon_note_map;
-    widget_class->unmap         = hildon_note_unmap;
     widget_class->realize       = hildon_note_realize;
+    widget_class->unrealize     = hildon_note_unrealize;
 
     g_object_class_install_property (object_class,
             PROP_HILDON_NOTE_TYPE,
@@ -353,6 +358,8 @@ hildon_note_class_init                          (HildonNoteClass *class)
      * HildonNote:icon:
      *
      * Icon for the note.
+     *
+     * Deprecated: Since 2.2
      */
     g_object_class_install_property (object_class,
             PROP_HILDON_NOTE_ICON,
@@ -366,6 +373,8 @@ hildon_note_class_init                          (HildonNoteClass *class)
      * HildonNote:stock-icon:
      *
      * Stock icon name for the note.
+     *
+     * Deprecated: Since 2.2
      */
     g_object_class_install_property (object_class,
             PROP_HILDON_NOTE_STOCK_ICON,
@@ -397,19 +406,27 @@ hildon_note_init                                (HildonNote *dialog)
 
     priv->label = gtk_label_new (NULL);
     gtk_label_set_line_wrap (GTK_LABEL (priv->label), TRUE);
-    
-    priv->icon  = gtk_image_new ();
-    priv->close_if_pressed_outside = FALSE;
-    priv->transfer_window = NULL;
+
+    priv->event_box = gtk_event_box_new ();
+    priv->icon = NULL;
+    priv->stock_icon = NULL;
+
+    gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->event_box), FALSE);
+    gtk_event_box_set_above_child (GTK_EVENT_BOX (priv->event_box), TRUE);
+    g_signal_connect (priv->event_box, "button-press-event",
+                      G_CALLBACK (event_box_press_event), dialog);
 
     /* Acquire real references to our internal children, since
        they are not nessecarily packed into container in each
        layout */
+    g_object_ref_sink (priv->event_box);
     g_object_ref_sink (priv->label);
-    g_object_ref_sink (priv->icon);
 
     gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
     gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
+    /* We use special hint to turn the note into information notification. */
+    gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_NOTIFICATION);
 }
 
 
@@ -422,11 +439,20 @@ hildon_note_finalize                            (GObject *obj_self)
     /* FIXME Some of this stuff should be moved to dispose */
 
     /* Free internal data */
+    if (priv->event_box)
+        g_object_unref (priv->event_box);
+
     if (priv->label)
         g_object_unref (priv->label);
 
-    if (priv->icon)
-        g_object_unref (priv->icon);
+    if (priv->icon) {
+        g_free (priv->icon);
+        priv->icon = NULL;
+    }
+    if (priv->stock_icon) {
+        g_free (priv->stock_icon);
+        priv->stock_icon = NULL;
+    }
 
     if (priv->progressbar)
         g_object_unref (priv->progressbar);
@@ -437,95 +463,32 @@ hildon_note_finalize                            (GObject *obj_self)
     G_OBJECT_CLASS (parent_class)->finalize (obj_self);
 }
 
-
-static gboolean
-hildon_note_button_release                      (GtkWidget *widget,
-                                                 GdkEventButton *event)
-{
-    int x, y;
-    gboolean info_note, released_outside;
-    HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (widget);
-
-    gdk_window_get_position (widget->window, &x, &y);
-
-    /* Whether the button has been released outside the widget */
-    released_outside = (event->x_root < x || event->x_root > x + widget->allocation.width ||
-                        event->y_root < y || event->y_root > y + widget->allocation.height);
-
-    /* Information notes are also closed by tapping on them */
-    info_note = (priv->note_n == HILDON_NOTE_TYPE_INFORMATION ||
-                 priv->note_n == HILDON_NOTE_TYPE_INFORMATION_THEME);
-
-    if (info_note || (released_outside && priv->close_if_pressed_outside)) {
-        gtk_dialog_response (GTK_DIALOG (widget), GTK_RESPONSE_CANCEL);
-    }
-
-    if (GTK_WIDGET_CLASS (parent_class)->button_release_event) {
-        return GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event);
-    } else {
-        return FALSE;
-    }
-}
-
 static void
-hildon_note_map                                 (GtkWidget *widget)
+label_size_request                              (GtkWidget      *label,
+                                                 GtkRequisition *req,
+                                                 GtkWidget      *note)
 {
-    HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (widget);
-    g_assert (priv);
-
-    /* Map the window */
-    GTK_WIDGET_CLASS (parent_class)->map (widget);
-
-    if (priv->transfer_window == NULL && priv->close_if_pressed_outside) {
-        gboolean has_grab = FALSE;
-
-        priv->transfer_window = grab_transfer_window_get (widget);
-
-        if (gdk_pointer_grab (priv->transfer_window, TRUE,
-                              GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
-                              GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
-                              GDK_POINTER_MOTION_MASK, NULL, NULL,
-                              GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS) {
-            if (gdk_keyboard_grab (priv->transfer_window, TRUE,
-                                   GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS) {
-                has_grab = TRUE;
-            } else {
-                gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
-                                            GDK_CURRENT_TIME);
-            }
-        }
-
-        if (has_grab) {
-            gtk_grab_add (widget);
-        } else {
-            gdk_window_destroy (priv->transfer_window);
-            priv->transfer_window = NULL;
-        }
-    }
+    gint note_height = MAX (HILDON_INFORMATION_NOTE_MIN_HEIGHT, req->height);
+    g_object_set (note, "height-request", note_height, NULL);
 }
 
 static void
-hildon_note_unmap                               (GtkWidget *widget)
+screen_size_changed                            (GdkScreen *screen,
+                                                GtkWidget *note)
 {
-    HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (widget);
-    g_assert (priv);
+    HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (note);
+    gint screen_width = gdk_screen_get_width (screen);
+    gint text_width = screen_width - HILDON_INFORMATION_NOTE_MARGIN * 2;
 
-    if (priv->transfer_window != NULL) {
-        /* Remove the grab */
-        gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
-                                    GDK_CURRENT_TIME);
-        gtk_grab_remove (widget);
-
-        /* Destroy the transfer window */
-        gdk_window_destroy (priv->transfer_window);
-        priv->transfer_window = NULL;
-    }
+    g_object_set (note, "width-request", screen_width, NULL);
+    g_object_set (priv->label, "width-request", text_width, NULL);
 }
 
 static void
 hildon_note_realize                             (GtkWidget *widget)
 {
     GdkDisplay *display;
+    gboolean is_info_note = FALSE;
     Atom atom;
     const gchar *notification_type;
     HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (widget);
@@ -543,9 +506,6 @@ hildon_note_realize                             (GtkWidget *widget)
         priv->sound_signal_handler = g_signal_connect_after(widget, 
                 "expose-event", G_CALLBACK (sound_handling), NULL);
 
-    /* We use special hint to turn the note into information notification. */
-    gdk_window_set_type_hint (widget->window, GDK_WINDOW_TYPE_HINT_NOTIFICATION);
-
     /* Set the _HILDON_NOTIFICATION_TYPE property so Matchbox places the window correctly */
     display = gdk_drawable_get_display (widget->window);
     atom = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_NOTIFICATION_TYPE");
@@ -553,6 +513,7 @@ hildon_note_realize                             (GtkWidget *widget)
     if (priv->note_n == HILDON_NOTE_TYPE_INFORMATION ||
         priv->note_n == HILDON_NOTE_TYPE_INFORMATION_THEME) {
         notification_type = "_HILDON_NOTIFICATION_TYPE_INFO";
+        is_info_note = TRUE;
     } else {
         notification_type = "_HILDON_NOTIFICATION_TYPE_CONFIRMATION";
     }
@@ -560,8 +521,28 @@ hildon_note_realize                             (GtkWidget *widget)
     XChangeProperty (GDK_WINDOW_XDISPLAY (widget->window), GDK_WINDOW_XID (widget->window),
                      atom, XA_STRING, 8, PropModeReplace, (guchar *) notification_type,
                      strlen (notification_type));
+
+    if (is_info_note) {
+        GdkScreen *screen = gtk_widget_get_screen (widget);
+        g_signal_connect (priv->label, "size-request", G_CALLBACK (label_size_request), widget);
+        g_signal_connect (screen, "size-changed", G_CALLBACK (screen_size_changed), widget);
+        screen_size_changed (screen, widget);
+    }
+}
+
+static void
+hildon_note_unrealize                           (GtkWidget *widget)
+{
+    HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (widget);
+    GdkScreen *screen = gtk_widget_get_screen (widget);
+
+    g_signal_handlers_disconnect_by_func (screen, G_CALLBACK (screen_size_changed), widget);
+    g_signal_handlers_disconnect_by_func (priv->label, G_CALLBACK (label_size_request), widget);
+
+    GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
 }
 
+
 /* Helper function for removing a widget from it's container.
    we own a separate reference to each object we try to unpack,
    so extra referencing is not needed. */
@@ -574,6 +555,33 @@ unpack_widget                                   (GtkWidget *widget)
         gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
 }
 
+/*
+  Name the widget and text label based on the note type. This is used
+  by the theme to give proper backgrounds depending on the note type.
+*/
+static void
+hildon_note_rename                              (HildonNote *note)
+{
+  GEnumValue *value;
+  GEnumClass *enum_class;
+  gchar *name;
+
+  HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE (note);
+
+  enum_class = g_type_class_ref (HILDON_TYPE_NOTE_TYPE);
+  value = g_enum_get_value (enum_class, priv->note_n);
+
+  name = g_strconcat ("HildonNote-", value->value_nick, NULL);
+  gtk_widget_set_name (GTK_WIDGET (note), name);
+  g_free (name);
+
+  name = g_strconcat ("HildonNoteLabel-", value->value_nick, NULL);
+  gtk_widget_set_name (priv->label, name);
+  g_free (name);
+
+  g_type_class_unref (enum_class);
+}
+
 static void
 hildon_note_rebuild                             (HildonNote *note)
 {
@@ -590,8 +598,8 @@ hildon_note_rebuild                             (HildonNote *note)
 
     /* Reuse exiting content widgets for new layout */
     unpack_widget (priv->label);
-    unpack_widget (priv->icon);
     unpack_widget (priv->progressbar);
+    unpack_widget (priv->event_box);
 
     /* Destroy old layout and buttons */
     if (priv->box) {
@@ -607,39 +615,29 @@ hildon_note_rebuild                             (HildonNote *note)
         priv->cancelButton = NULL;
     }
 
-    /* By default the note won't be closed when pressing outside */
-    priv->close_if_pressed_outside = FALSE;
-
     /* Add needed buttons and images for each note type */
     switch (priv->note_n)
     {
         case HILDON_NOTE_TYPE_CONFIRMATION:
             priv->okButton = gtk_dialog_add_button (dialog,
-                    _("ecdg_bd_confirmation_note_ok"), GTK_RESPONSE_OK);
+                    _("wdgt_bd_yes"), GTK_RESPONSE_OK);
             priv->cancelButton = gtk_dialog_add_button (dialog,
-                    _("ecdg_bd_confirmation_note_cancel"), GTK_RESPONSE_CANCEL);
-
-            /* Fall through */
-        case HILDON_NOTE_TYPE_CONFIRMATION_BUTTON:
-            gtk_image_set_from_icon_name (GTK_IMAGE (priv->icon),
-                    HILDON_NOTE_CONFIRMATION_ICON, 
-                    HILDON_ICON_SIZE_BIG_NOTE);
-            break;
-
-        case HILDON_NOTE_TYPE_INFORMATION_THEME:
-        case HILDON_NOTE_TYPE_INFORMATION:
-            priv->close_if_pressed_outside = TRUE;
-            gtk_image_set_from_icon_name (GTK_IMAGE (priv->icon),
-                    HILDON_NOTE_INFORMATION_ICON,
-                    HILDON_ICON_SIZE_BIG_NOTE);
+                    _("wdgt_bd_no"), GTK_RESPONSE_CANCEL);
+            gtk_widget_show (priv->cancelButton);
+            gtk_widget_set_no_show_all (priv->cancelButton, FALSE);
             break;
 
         case HILDON_NOTE_TYPE_PROGRESSBAR:
             priv->cancelButton = gtk_dialog_add_button (dialog,
-                    _("ecdg_bd_cancel_note_cancel"), GTK_RESPONSE_CANCEL);
+                    _("wdgt_bd_stop"), GTK_RESPONSE_CANCEL);
+            gtk_widget_show (priv->cancelButton);
+            gtk_widget_set_no_show_all (priv->cancelButton, FALSE);
             IsHorizontal = FALSE;
             break;
 
+        case HILDON_NOTE_TYPE_CONFIRMATION_BUTTON:
+        case HILDON_NOTE_TYPE_INFORMATION_THEME:
+        case HILDON_NOTE_TYPE_INFORMATION:
         default:
             break;
     }
@@ -647,27 +645,23 @@ hildon_note_rebuild                             (HildonNote *note)
     if (IsHorizontal) {
         /* Pack item with label horizontally */
         priv->box = gtk_hbox_new (FALSE, HILDON_MARGIN_DEFAULT);
-        gtk_container_add (GTK_CONTAINER (dialog->vbox), priv->box);
+        gtk_container_add (GTK_CONTAINER (priv->event_box), priv->box);
 
-        if (priv->icon) {
-            GtkWidget *alignment = gtk_alignment_new (0, 0, 0, 0);
-
-            gtk_box_pack_start (GTK_BOX (priv->box), alignment, FALSE, FALSE, 0);
-            gtk_container_add (GTK_CONTAINER (alignment), priv->icon);
-        }
         gtk_box_pack_start (GTK_BOX (priv->box), priv->label, TRUE, TRUE, 0);
 
     } else {
         /* Pack item with label vertically */
         priv->box = gtk_vbox_new (FALSE, HILDON_MARGIN_DOUBLE);
-        gtk_container_add (GTK_CONTAINER (dialog->vbox), priv->box);
+        gtk_container_add (GTK_CONTAINER (priv->event_box), priv->box);
         gtk_box_pack_start (GTK_BOX (priv->box), priv->label, TRUE, TRUE, 0);
 
         if (priv->progressbar)
             gtk_box_pack_start (GTK_BOX (priv->box), priv->progressbar, FALSE, FALSE, 0);
     }
 
-    gtk_widget_show_all (priv->box);
+    gtk_container_add (GTK_CONTAINER (dialog->vbox), priv->event_box);
+
+    gtk_widget_show_all (priv->event_box);
 }
 
 /**
@@ -702,6 +696,7 @@ hildon_note_new_confirmation_add_buttons        (GtkWindow *parent,
     va_list args;
     char *message;
     int value;
+    GtkWidget *button;
 
     g_return_val_if_fail (description != NULL, NULL);
 
@@ -709,7 +704,6 @@ hildon_note_new_confirmation_add_buttons        (GtkWindow *parent,
         g_object_new (HILDON_TYPE_NOTE,
                 "note-type", HILDON_NOTE_TYPE_CONFIRMATION_BUTTON,
                 "description", description,
-                "icon", HILDON_NOTE_CONFIRMATION_ICON, 
                 NULL);
 
     if (parent != NULL)
@@ -726,7 +720,13 @@ hildon_note_new_confirmation_add_buttons        (GtkWindow *parent,
         }
         value = va_arg (args, int);
 
-        gtk_dialog_add_button (GTK_DIALOG (conf_note), message, value);
+        button = gtk_dialog_add_button (GTK_DIALOG (conf_note), message, value);
+        /* maemo-gtk is going to set the "no-show-all" property all
+           cancel/close-like buttons to TRUE, so that they are not shown. On
+           the other hand, this confirmation note with custom buttons should
+           not obey this rule, so we need to make sure they are shown. */
+        gtk_widget_show (button);
+        gtk_widget_set_no_show_all (button, FALSE);
     }
 
     va_end (args);
@@ -743,9 +743,9 @@ hildon_note_new_confirmation_add_buttons        (GtkWindow *parent,
  *   correctly. In GTK the X window ID can be checked using
  *   GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
  * @description: the message to confirm
- * 
- * Create a new confirmation note. Confirmation note has text (description)
- * that you specify, two buttons and a default confirmation stock icon.
+ *
+ * Create a new confirmation note. Confirmation note has a text (description)
+ * that you specify and two buttons.
  *
  * Returns: a #GtkWidget pointer of the note
  */
@@ -753,8 +753,19 @@ GtkWidget*
 hildon_note_new_confirmation                    (GtkWindow *parent,
                                                  const gchar *description)
 {
-    return hildon_note_new_confirmation_with_icon_name
-        (parent, description, HILDON_NOTE_CONFIRMATION_ICON);
+    GtkWidget *dialog = NULL;
+
+    g_return_val_if_fail (description != NULL, NULL);
+
+    dialog = g_object_new (HILDON_TYPE_NOTE,
+            "note-type",
+            HILDON_NOTE_TYPE_CONFIRMATION,
+            "description", description, NULL);
+
+    if (parent != NULL)
+        gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+
+    return dialog;
 }
 
 /**
@@ -767,8 +778,11 @@ hildon_note_new_confirmation                    (GtkWindow *parent,
  * @description: the message to confirm
  * @icon_name: icon to be displayed. If NULL, default icon is used.
  * 
- * Create a new confirmation note. Confirmation note has text(description) 
- * that you specify, two buttons and an icon.
+ * Create a new confirmation note. Confirmation note has a text (description) 
+ * that you specify and two buttons.
+ *
+ * Deprecated: Since 2.2, icons are not shown in confirmation notes. Icons set
+ * with this function will be ignored. Use hildon_note_new_confirmation() instead.
  *
  * Returns: a #GtkWidget pointer of the note
  */
@@ -777,20 +791,7 @@ hildon_note_new_confirmation_with_icon_name     (GtkWindow *parent,
                                                  const gchar *description,
                                                  const gchar *icon_name)
 {
-    GtkWidget *dialog = NULL;
-
-    g_return_val_if_fail (description != NULL, NULL);
-
-    dialog = g_object_new (HILDON_TYPE_NOTE,
-            "note-type",
-            HILDON_NOTE_TYPE_CONFIRMATION,
-            "description", description, "icon",
-            icon_name, NULL);
-
-    if (parent != NULL)
-        gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
-
-    return dialog;
+  return hildon_note_new_confirmation (parent, description);
 }
 
 /**
@@ -802,8 +803,8 @@ hildon_note_new_confirmation_with_icon_name     (GtkWindow *parent,
  *   GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
  * @description: the message to confirm
  * 
- * Create a new information note. Information note has a text(description) 
- * that you specify, an OK button and an icon.
+ * Create a new information note. Information note has a text (description)
+ * that you specify and an OK button.
  * 
  * Returns: a #GtkWidget pointer of the note
  */
@@ -811,8 +812,19 @@ GtkWidget*
 hildon_note_new_information                     (GtkWindow *parent,
                                                  const gchar *description)
 {
-    return hildon_note_new_information_with_icon_name
-        (parent, description, HILDON_NOTE_INFORMATION_ICON);
+    GtkWidget *dialog = NULL;
+
+    g_return_val_if_fail (description != NULL, NULL);
+
+    dialog = g_object_new (HILDON_TYPE_NOTE,
+            "note-type",
+            HILDON_NOTE_TYPE_INFORMATION_THEME,
+            "description", description, NULL);
+
+    if (parent != NULL)
+        gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+
+    return dialog;
 }
 
 /**
@@ -828,6 +840,9 @@ hildon_note_new_information                     (GtkWindow *parent,
  * Create a new information note. Information note has text(description) 
  * that you specify, an OK button and an icon.
  * 
+ * Deprecated: Since 2.2, icons are not shown in confirmation notes. Icons set
+ * with this function will be ignored. Use hildon_note_new_information() instead.
+ *
  * Returns: a #GtkWidget pointer of the note
  */
 GtkWidget*
@@ -835,21 +850,7 @@ hildon_note_new_information_with_icon_name      (GtkWindow * parent,
                                                  const gchar *description,
                                                  const gchar *icon_name)
 {
-    GtkWidget *dialog = NULL;
-
-    g_return_val_if_fail (description != NULL, NULL);
-    g_return_val_if_fail (icon_name != NULL, NULL);
-
-    dialog = g_object_new (HILDON_TYPE_NOTE,
-            "note-type",
-            HILDON_NOTE_TYPE_INFORMATION_THEME,
-            "description", description,
-            "icon", icon_name, NULL);
-
-    if (parent != NULL)
-        gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
-
-    return dialog;
+    return hildon_note_new_information (parent, description);
 }
 
 /* FIXME This documentation string LIES! */
@@ -918,7 +919,7 @@ hildon_note_set_button_text                     (HildonNote *note,
     if (priv->okButton) {
         gtk_button_set_label (GTK_BUTTON (priv->okButton), text);
         gtk_button_set_label (GTK_BUTTON (priv->cancelButton),
-                _("ecdg_bd_confirmation_note_cancel"));
+                _("wdgt_bd_no"));
     } else {
         gtk_button_set_label (GTK_BUTTON (priv->cancelButton), text);
     }