Re: Frustration with GtkActions



On Tue, 2008-01-08 at 16:02 -0500, Randy Poe wrote:
Any suggestions?
Register new stock items for all the menu items you want covered by
actions.

I use the function below for icons, and gtk_stock_add() for labels.

void add_stock_icon (const gchar *filename, const gchar *stock_id)
  {
  GtkIconSource *icon_source = NULL ;
  GtkIconSet *icon_set = NULL ;
  static GtkIconFactory *icon_factory = NULL ;
  char *psz = NULL ;

  if (NULL == icon_factory)
    gtk_icon_factory_add_default (icon_factory = gtk_icon_factory_new
()) ;

  if (NULL != (icon_source = gtk_icon_source_new ()))
    {
    gtk_icon_source_set_filename (icon_source, psz = find_pixmap_file
(filename)) ;
//    gtk_icon_source_set_size_wildcarded (icon_source, TRUE) ;
    if (NULL == (icon_set = gtk_icon_factory_lookup (icon_factory,
stock_id)))
      {
      icon_set = gtk_icon_set_new () ;
      gtk_icon_factory_add (icon_factory, stock_id, icon_set) ;
      }
    gtk_icon_set_add_source (icon_set, icon_source) ;
    }
  }

HTH,



Gabriel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]