#include "hildon-note.h"
#include "hildon-defines.h"
#include "hildon-sound.h"
-#include "hildon-banner.h"
+#include "hildon-gtk.h"
#include "hildon-enum-types.h"
#include "hildon-note-private.h"
hildon_note_unrealize (GtkWidget *widget);
static void
+hildon_note_size_request (GtkWidget *note,
+ GtkRequisition *req);
+
+static void
label_size_request (GtkWidget *label,
GtkRequisition *req,
GtkWidget *note);
object_class->get_property = hildon_note_get_property;
widget_class->realize = hildon_note_realize;
widget_class->unrealize = hildon_note_unrealize;
+ widget_class->size_request = hildon_note_size_request;
/**
* HildonNote:type:
/**
* HildonNote:progressbar:
*
- * If set, a #GtkProgressBar visible in the note.
+ * If set, a #GtkProgressBar is displayed in the note.
*/
g_object_class_install_property (object_class,
PROP_HILDON_NOTE_PROGRESSBAR,
}
static void
+hildon_note_size_request (GtkWidget *note,
+ GtkRequisition *req)
+{
+ GTK_WIDGET_CLASS (parent_class)->size_request (note, req);
+ req->width = gdk_screen_get_width (gtk_widget_get_screen (note));
+}
+
+static void
screen_size_changed (GdkScreen *screen,
GtkWidget *note)
{
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;
+
+ hildon_note_rename (HILDON_NOTE (note));
if (priv->note_n == HILDON_NOTE_TYPE_INFORMATION ||
priv->note_n == HILDON_NOTE_TYPE_INFORMATION_THEME) {
- g_object_set (note, "width-request", screen_width, NULL);
+ gint screen_width = gdk_screen_get_width (screen);
+ gint text_width = screen_width - HILDON_INFORMATION_NOTE_MARGIN * 2;
g_object_set (priv->label, "width-request", text_width, NULL);
return;
GdkScreen *screen = gtk_widget_get_screen (widget);
g_signal_connect (screen, "size-changed", G_CALLBACK (screen_size_changed), widget);
screen_size_changed (screen, widget);
+
+ hildon_gtk_window_set_portrait_flags (GTK_WINDOW (widget), HILDON_PORTRAIT_MODE_SUPPORT);
}
static void
GEnumValue *value;
GEnumClass *enum_class;
gchar *name;
+ GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (note));
+ gboolean portrait = gdk_screen_get_width (screen) < gdk_screen_get_height (screen);
+ const gchar *portrait_suffix = portrait ? "-portrait" : NULL;
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);
+ name = g_strconcat ("HildonNote-", value->value_nick, portrait_suffix, NULL);
gtk_widget_set_name (GTK_WIDGET (note), name);
g_free (name);
* it would only contain the "additional" buttons? However, changing
* this would break those applications that rely on current behaviour.
*
- * Returns: A #GtkWidget pointer of the note
+ * Returns: A new #HildonNote.
*/
GtkWidget*
hildon_note_new_confirmation_add_buttons (GtkWindow *parent,
* important so that the window manager could handle the windows
* correctly. In GTK the X window ID can be checked using
* GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
- * @description: the message to confirm
+ * @description: the message to confirm.
*
* Create a new confirmation note. Confirmation note has a text (description)
* that you specify and two buttons.
*
- * Returns: a #GtkWidget pointer of the note
+ * Returns: a new #HildonNote.
*/
GtkWidget*
hildon_note_new_confirmation (GtkWindow *parent,
* 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
+ * Returns: a new #HildonNote.
*/
GtkWidget*
hildon_note_new_confirmation_with_icon_name (GtkWindow *parent,
* important so that the window manager could handle the windows
* correctly. In GTK the X window ID can be checked using
* GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
- * @description: the message to confirm
+ * @description: the message to confirm.
*
- * Create a new information note. Information note has a text (description)
+ * Create a new information note. Information note has text (a description)
* that you specify and an OK button.
*
- * Returns: a #GtkWidget pointer of the note
+ * Returns: a new #HildonNote.
*/
GtkWidget*
hildon_note_new_information (GtkWindow *parent,
* important so that the window manager could handle the windows
* correctly. In GTK the X window ID can be checked using
* GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
- * @description: the message to confirm
- * @icon_name: icon to be displayed. If NULL, default icon is used.
+ * @description: the message to confirm.
+ * @icon_name: icon to be displayed. If %NULL, the default icon is used.
*
- * Create a new information note. Information note has text(description)
+ * Create a new information note. An information note has text (a 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.
+ * with this function will be ignored. Use hildon_note_new_information()
+ * instead.
*
- * Returns: a #GtkWidget pointer of the note
+ * Returns: a new #HildonNote.
*/
GtkWidget*
hildon_note_new_information_with_icon_name (GtkWindow * parent,
* important so that the window manager could handle the windows
* correctly. In GTK the X window ID can be checked using
* GDK_WINDOW_XID(GTK_WIDGET(parent)->window).
- * @description: the action to cancel
+ * @description: the action to cancel.
* @progressbar: a pointer to #GtkProgressBar to be filled with the
* progressbar assigned to this note. Use this to set the fraction of
* progressbar done. This parameter can be %NULL as well, in which
/**
* hildon_note_set_button_text:
- * @note: a #HildonNote
- * @text: sets the button text and if there is two buttons in dialog,
+ * @note: a #HildonNote.
+ * @text: sets the button text. If there are two buttons in dialog,
* the button texts will be <text>, "Cancel".
*
* Sets the text of the button in @note.
/**
* hildon_note_set_button_texts:
- * @note: a #HildonNote
- * @text_ok: the new text of the default OK button
- * @text_cancel: the new text of the default cancel button
+ * @note: a #HildonNote.
+ * @text_ok: the new text of the default OK button.
+ * @text_cancel: the new text of the default cancel button.
*
* Sets the text for the buttons in @note.
*/