question on creation of IconFactories



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I have some questions on creating an icon factory.

I've been thru the dev help, and i think i'me doing things correctly. Let me
describe what i'm doing, what works, and what doesn't.

I create a IconSource, and associate it with a file, and wild card everything.
I then add that IconSource to a newly created IconSet. I then add that IconSet
to my IconFactory (which has already been gtk_icon_factory_add_default'ed

This is the relevant code:


        icon_source = gtk_icon_source_new();
        strcat(theme_path, theme_dir_ent->d_name);
        gtk_icon_source_set_filename(icon_source, theme_path);
        gtk_icon_source_set_direction_wildcarded(icon_source, TRUE);
        gtk_icon_source_set_size_wildcarded(icon_source, TRUE);
        gtk_icon_source_set_state_wildcarded(icon_source, TRUE);

        icon_set = gtk_icon_set_new();
        gtk_icon_set_add_source(icon_set, icon_source);
        gtk_icon_source_free(icon_source);

        gtk_icon_factory_add(icon_factory, icon_def->stock_id, icon_set);
        gtk_icon_set_unref(icon_set);

Next I reference the icon via a gtk_image_new_from_stock, and attempt to get the
pixbuf from the returned gtkImage:

        image = gtk_image_new_from_stock(stock_id, size);
        pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image));

The image does return. Under ddd I look at image, and this is what I see:

(gdb) print *image
$2 = {object = {parent_instance = {g_type_instance = {g_class = 0x8311910},
ref_count = 1, qdata = 0x0}, flags = 2098722}, private_flags = 15360, state = 0
'\0', saved_state = 0 '\0', name = 0x0, style = 0x82fe0e0, requisition = {width
= 0, height = 0}, allocation = {x = -1, y = -1, width = 1, height = 1}, window =
0x0, parent = 0x0}

When I execute the next instruction:

        pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image));

I get the Gtk-CRITICAL message:

        Gtk-CRITICAL **: gtk_image_get_pixbuf: assertion `image->storage_type ==
GTK_IMAGE_PIXBUF || image->storage_type == GTK_IMAGE_EMPTY' failed

and the returned result is NULL.

At this point, I'm not sure what is expected, or how to deal with this error.

Any suggestions ?

Many thanks, and best rgds,

- -Greg

- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler redhat com    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHbdD2404fl/0CV/QRAopXAKCgsYULfCC/7A6a74Kjv259EWGczgCePpp1
EY0wKwyP8dhQqz6mt1ClLbs=
=Tebc
-----END PGP SIGNATURE-----



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