Make HildonNote request always the full width of the screen
authorAlberto Garcia <agarcia@igalia.com>
Tue, 16 Jun 2009 12:02:12 +0000 (14:02 +0200)
committerAlberto Garcia <agarcia@igalia.com>
Tue, 16 Jun 2009 12:02:12 +0000 (14:02 +0200)
* hildon/hildon-note.c (hildon_note_class_init)
(+hildon_note_size_request, screen_size_changed):
Always request the full width of the screen.

Fixes: NB#118375 (unnecessary rescaling of images)

ChangeLog
hildon/hildon-note.c

index 3532a11..36d2f7a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-06-16  Alberto Garcia  <agarcia@igalia.com>
+
+       * hildon/hildon-note.c (hildon_note_class_init)
+       (+hildon_note_size_request, screen_size_changed):
+       Always request the full width of the screen.
+
+       Fixes: NB#118375 (unnecessary rescaling of images)
+
 2009-06-16  Alejandro G. Castro  <alex@igalia.com>
 
        * hildon/hildon-pannable-area.c,
index 2c1efde..278fc3d 100644 (file)
@@ -126,6 +126,10 @@ static void
 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);
@@ -335,6 +339,7 @@ hildon_note_class_init                          (HildonNoteClass *class)
     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:
@@ -534,16 +539,23 @@ hildon_note_orientation_update (HildonNote *note, GdkScreen *screen)
 }
 
 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;
 
     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;