#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include "gtkalias.h"
#include <pango/pango-utils.h> /* For pango_scan_* */
#include "gtkiconfactory.h"
#include "stock-icons/gtkstockpixbufs.h"
#include "gtkwidget.h"
#include "gtkintl.h"
+
static GSList *all_icon_factories = NULL;
typedef enum {
16, stock_directory_16,
24, stock_directory_24);
+ add_icon2 (factory, GTK_STOCK_ABOUT,
+ 16, stock_about_16,
+ 24, stock_about_24);
+
+ add_icon2 (factory, GTK_STOCK_CONNECT,
+ 16, stock_connect_16,
+ 24, stock_connect_24);
+
+ add_icon2 (factory, GTK_STOCK_DISCONNECT,
+ 16, stock_disconnect_16,
+ 24, stock_disconnect_24);
+
+ add_icon2 (factory, GTK_STOCK_EDIT,
+ 16, stock_edit_16,
+ 24, stock_edit_24);
+
+ add_icon_bidi2 (factory, GTK_STOCK_MEDIA_FORWARD,
+ 16, stock_media_forward_16, stock_media_rewind_16,
+ 24, stock_media_forward_24, stock_media_rewind_24);
+
+ add_icon_bidi2 (factory, GTK_STOCK_MEDIA_NEXT,
+ 16, stock_media_next_16, stock_media_previous_16,
+ 24, stock_media_next_24, stock_media_previous_24);
+
+ add_icon2 (factory, GTK_STOCK_MEDIA_PAUSE,
+ 16, stock_media_pause_16,
+ 24, stock_media_pause_24);
+
+ add_icon_bidi2 (factory, GTK_STOCK_MEDIA_PLAY,
+ 16, stock_media_play_16, stock_media_play_rtl_16,
+ 24, stock_media_play_24, stock_media_play_rtl_24);
+
+ add_icon_bidi2 (factory, GTK_STOCK_MEDIA_PREVIOUS,
+ 16, stock_media_previous_16, stock_media_next_16,
+ 24, stock_media_previous_24, stock_media_next_24);
+
+ add_icon2 (factory, GTK_STOCK_MEDIA_RECORD,
+ 16, stock_media_record_16,
+ 24, stock_media_record_24);
+
+ add_icon_bidi2 (factory, GTK_STOCK_MEDIA_REWIND,
+ 16, stock_media_rewind_16, stock_media_forward_16,
+ 24, stock_media_rewind_24, stock_media_forward_24);
+
+ add_icon2 (factory, GTK_STOCK_MEDIA_STOP,
+ 16, stock_media_stop_16,
+ 24, stock_media_stop_24);
+
/* Generic size only */
add_icon (factory, GTK_STOCK_CLEAR, 24, stock_clear_24);
GtkIconTheme *icon_theme;
GtkSettings *settings;
gint width, height, pixel_size;
+ gint *sizes, *s, dist;
GError *error = NULL;
if (widget && gtk_widget_has_screen (widget))
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);