Changeset 2708


Ignore:
Timestamp:
08/15/07 17:32:50 (6 years ago)
Author:
thomas
Message:
  • libmokoui/moko-stock.c: (_moko_stock_add_icon): Add a hack to make sure we

at least have a version of the icons available at each possible GtkIconSize?

Location:
trunk/src/target/OM-2007.2/libraries/libmokoui2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog

    r2626 r2708  
     12007-08-15  Thomas Wood  <thomas@openedhand.com> 
     2 
     3        * libmokoui/moko-stock.c: (_moko_stock_add_icon): Add a hack to make sure we 
     4        at least have a version of the icons available at each possible GtkIconSize 
     5 
    162007-08-03  Holger Hans Peter Freyther  <zecke@selfish.org> 
    27 
  • trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-stock.c

    r2487 r2708  
    7070{ 
    7171  static GtkIconTheme *theme = NULL; 
    72   GtkIconSource       *source = NULL; 
     72  GtkIconSource       *source; 
    7373  GtkIconSet          *set = NULL; 
    7474  GdkPixbuf           *pixbuf = NULL; 
     75  int i; 
    7576 
    7677  if (theme == NULL) 
    7778    theme = gtk_icon_theme_get_default (); 
    7879 
    79   source = gtk_icon_source_new (); 
    80  
    81   gtk_icon_source_set_size (source, GTK_ICON_SIZE_BUTTON); 
    82   gtk_icon_source_set_size_wildcarded (source, FALSE); 
    83  
    8480  pixbuf = gtk_icon_theme_load_icon (theme, item->stock_id, 
    8581                                     32, 0, NULL); 
     82 
    8683  if (pixbuf == NULL) 
    8784  { 
     
    9087  } 
    9188 
    92   gtk_icon_source_set_pixbuf (source, pixbuf); 
    93  
    94   g_object_unref (G_OBJECT (pixbuf)); 
    95  
    9689  set = gtk_icon_set_new (); 
    9790 
    98   gtk_icon_set_add_source (set, source); 
    99   gtk_icon_source_free (source); 
     91  /* 
     92   * This is temporary hack to make sure we have all the sizes available. 
     93   * Ideally we should try loading the pixbuf at the correct size from the theme 
     94   * for each possible size in GtkIconSize, rather than re-using the same pixbuf 
     95   */ 
     96  for (i = GTK_ICON_SIZE_MENU; i <= GTK_ICON_SIZE_DIALOG; i++) 
     97  { 
     98    source = gtk_icon_source_new (); 
     99    gtk_icon_source_set_size (source, i); 
     100    gtk_icon_source_set_size_wildcarded (source, FALSE); 
     101    gtk_icon_source_set_pixbuf (source, pixbuf); 
     102    gtk_icon_set_add_source (set, source); 
     103    gtk_icon_source_free (source); 
     104  } 
     105 
     106 
     107 
    100108 
    101109  gtk_icon_factory_add (factory, item->stock_id, set); 
    102110  gtk_icon_set_unref (set); 
     111 
     112 
     113 
     114  g_object_unref (G_OBJECT (pixbuf)); 
    103115} 
    104116 
Note: See TracChangeset for help on using the changeset viewer.