]> Pileus Git - ~andy/gtk/commitdiff
Doc update.
authorMatthias Clasen <mclasen@redhat.com>
Mon, 16 Aug 2004 18:38:55 +0000 (18:38 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 16 Aug 2004 18:38:55 +0000 (18:38 +0000)
2004-08-16  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.

* gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
use the available size closest to 48.  (#150147)

* gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
a pointer to the beginning of the sizes array, not the end.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkiconfactory.c
gtk/gtkicontheme.c
gtk/gtkwidget.c

index f5a29422da362c585b5afe840545147ad2d5aef1..dd93bf5e3b14d4f3f4e9be7ca089181d4a9cd392 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+<<<<<<< ChangeLog
+2004-08-16  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.
+
+       * gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
+       use the available size closest to 48.  (#150147)
+
+       * gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
+       a pointer to the beginning of the sizes array, not the end.
+
 2004-08-16  Morten Welinder  <terra@gnome.org>
 
        * gtk/gtksequence.c (_gtk_sequence_set): Fix C99ism.
@@ -8,7 +19,6 @@
 
 Mon Aug 16 01:35:25 2004  Matthias Clasen  <maclas@gmx.de>
 
-       Fix #150125:
        
        * gtk/gtkcombobox.[hc]: Add a ::focus-on-click property and
        change the default behaviour to focus on click.
index f5a29422da362c585b5afe840545147ad2d5aef1..dd93bf5e3b14d4f3f4e9be7ca089181d4a9cd392 100644 (file)
@@ -1,3 +1,14 @@
+<<<<<<< ChangeLog
+2004-08-16  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.
+
+       * gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
+       use the available size closest to 48.  (#150147)
+
+       * gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
+       a pointer to the beginning of the sizes array, not the end.
+
 2004-08-16  Morten Welinder  <terra@gnome.org>
 
        * gtk/gtksequence.c (_gtk_sequence_set): Fix C99ism.
@@ -8,7 +19,6 @@
 
 Mon Aug 16 01:35:25 2004  Matthias Clasen  <maclas@gmx.de>
 
-       Fix #150125:
        
        * gtk/gtkcombobox.[hc]: Add a ::focus-on-click property and
        change the default behaviour to focus on click.
index f5a29422da362c585b5afe840545147ad2d5aef1..dd93bf5e3b14d4f3f4e9be7ca089181d4a9cd392 100644 (file)
@@ -1,3 +1,14 @@
+<<<<<<< ChangeLog
+2004-08-16  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.
+
+       * gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
+       use the available size closest to 48.  (#150147)
+
+       * gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
+       a pointer to the beginning of the sizes array, not the end.
+
 2004-08-16  Morten Welinder  <terra@gnome.org>
 
        * gtk/gtksequence.c (_gtk_sequence_set): Fix C99ism.
@@ -8,7 +19,6 @@
 
 Mon Aug 16 01:35:25 2004  Matthias Clasen  <maclas@gmx.de>
 
-       Fix #150125:
        
        * gtk/gtkcombobox.[hc]: Add a ::focus-on-click property and
        change the default behaviour to focus on click.
index f5a29422da362c585b5afe840545147ad2d5aef1..dd93bf5e3b14d4f3f4e9be7ca089181d4a9cd392 100644 (file)
@@ -1,3 +1,14 @@
+<<<<<<< ChangeLog
+2004-08-16  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.
+
+       * gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
+       use the available size closest to 48.  (#150147)
+
+       * gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
+       a pointer to the beginning of the sizes array, not the end.
+
 2004-08-16  Morten Welinder  <terra@gnome.org>
 
        * gtk/gtksequence.c (_gtk_sequence_set): Fix C99ism.
@@ -8,7 +19,6 @@
 
 Mon Aug 16 01:35:25 2004  Matthias Clasen  <maclas@gmx.de>
 
-       Fix #150125:
        
        * gtk/gtkcombobox.[hc]: Add a ::focus-on-click property and
        change the default behaviour to focus on click.
index b3915571c16dfc786e8b345ef5484bd0ad221281..5a93420c1c2cf1c7577705c040c7c2e66e3b9cfb 100644 (file)
@@ -1649,6 +1649,7 @@ render_icon_name_pixbuf (GtkIconSource    *icon_source,
   GtkIconTheme *icon_theme;
   GtkSettings *settings;
   gint width, height, pixel_size;
+  gint *sizes, *s, dist;
   GError *error = NULL;
   
   if (widget && gtk_widget_has_screen (widget))
@@ -1667,8 +1668,45 @@ render_icon_name_pixbuf (GtkIconSource    *icon_source,
 
   if (!gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
     {
-      g_warning ("Invalid icon size %d\n", size);
-      width = height = 24;
+      if (size == -1)
+       {
+         /* Find an available size close to 48 
+          */
+         sizes = gtk_icon_theme_get_icon_sizes (icon_theme, icon_source->source.icon_name);
+         dist = 1000;
+         width = height = 48;
+         for (s = sizes; *s; s++)
+           {
+             if (*s == -1)
+               {
+                 width = height = 48;
+                 break;
+               }
+             if (*s < 48)
+               {
+                 if (48 - *s < dist)
+                   {
+                     width = height = *s;
+                     dist = 48 - *s;
+                   }
+               }
+             else 
+               {
+                 if (*s - 48 < dist)
+                   {
+                     width = height = *s;
+                     dist = *s - 48;
+                   }
+               }
+           }
+         
+         g_free (sizes);
+       }
+      else
+       {
+         g_warning ("Invalid icon size %d\n", size);
+         width = height = 24;
+       }
     }
 
   pixel_size = MIN (width, height);
index 2f1f43f7fe626f67abc21b1ebd9f3018dfa0fcba..b8db2b64022f317a15cd2263f07178adf61011c9 100644 (file)
@@ -1331,7 +1331,7 @@ gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
 {
   GList *l, *d;
   GHashTable *sizes;
-  gint *result;
+  gint *result, *r;
   guint suffix;
   
   GtkIconThemePrivate *priv;
@@ -1362,9 +1362,9 @@ gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
        }
     }
 
-  result = g_new0 (gint, g_hash_table_size (sizes) + 1);
+  r = result = g_new0 (gint, g_hash_table_size (sizes) + 1);
 
-  g_hash_table_foreach (sizes, add_size, &result);
+  g_hash_table_foreach (sizes, add_size, &r);
   g_hash_table_destroy (sizes);
   
   return result;
index 7a88f5978558cc4350de4ed709f3d8c12baecc57..58696d247dde89a717354b6306e9dd73ff252353 100644 (file)
@@ -5041,7 +5041,8 @@ gtk_widget_create_pango_layout (GtkWidget   *widget,
  * @widget: a #GtkWidget
  * @stock_id: a stock ID
  * @size: a stock size. A size of (GtkIconSize)-1 means render at 
-      the size of the source and don't scale.
+ *     the size of the source and don't scale (if there are multiple 
+ *     source sizes, GTK+ picks one of the available sizes).
  * @detail: render detail to pass to theme engine
  * 
  * A convenience function that uses the theme engine and RC file