[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: question on creation of IconFactories
- From: Gregory Hosler <ghosler redhat com>
- To: gtk-app-devel-list gnome org
- Subject: Re: question on creation of IconFactories
- Date: Sun, 23 Dec 2007 11:34:12 +0800
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Gregory Hosler wrote:
> 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
As some followup investigation, I single stepped thru gtk_image_get_pixbuf() to
see what is happening.
It seems that gtk_image_get_pixbuf() is expecting the image->storage_type to be
either GTK_IMAGE_PIXBUF ot GTK_IMAGE_EMPTY.
In the case of a "stock image", the storage_type is set to "GTK_IMAGE_STOCK",
and so this test fails...
Which begs the question(s): Do GTK_STOCK_IMAGES *not* have pixbufs ? (if I look
at image->data.pibbuf.pixbuf, I see a non-null pointer...)
And more importantly, how might I get the pixbuf from a stock_icon image ?
Many thanks, and best rgds,
- -Greg
> 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)
iD8DBQFHbdcy404fl/0CV/QRAhlyAJ44ipND2HZy6mtUCjiJxm/BmxG5dgCdHqL6
Uj/jLFN9ooBXy2H4luSSHuw=
=QpXH
-----END PGP SIGNATURE-----
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]