Re: stock icon themes



Tim Janik <timj@gtk.org> writes:
> > 
> > How would you refer to a specific C variable from an RC file?
> > 
> > All I can think of is to register the C variable in advance under some
> > name, but that's the same as just adding the inline pixbuf to the
> > default icon factory as the default icon for a given stock ID.
> 
> hm ok, i see. could you give an example on how code like
> that would look like for the application programmer?
> 

Something like:

static void
add_inline (GtkIconFactory *factory, const gchar *stock_id, 
            const guchar *inline_data)
{
  GtkIconSet *set;
  GtkIconSource source = { NULL, NULL, 0, 0, 0,
                           TRUE, TRUE, TRUE };

  set = gtk_icon_set_new ();

  source.pixbuf = gdk_pixbuf_new_from_inline (inline_data, FALSE, -1);

  gtk_icon_set_add_source (set, &source);

  gtk_icon_factory_add (factory, stock_id, set);

  gtk_icon_set_unref (set);
}


static void
setup_icons (void)
{

  GtkIconFactory *factory;

  factory = gtk_icon_factory_new ();
  gtk_push_default_icon_factory (factory);
  g_object_unref (G_OBJECT (factory));

  add_inline (factory, "my-stock-id", my_inline_data);
  add_inline (factory, "other-stock-id", my_other_data);
}

Havoc





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