Re: gtk_rc_parse and pixmap_path
- From: Owen Taylor <otaylor redhat com>
- To: "no6 pobox com" <number6 ip120 gte16 rb1 bel nwlink com>
- Cc: gtk-list gnome org
- Subject: Re: gtk_rc_parse and pixmap_path
- Date: 29 Jun 2003 13:49:56 -0400
On Sun, 2003-06-29 at 13:18, no6 pobox com wrote:
> I know It's bad form to answer your own posts.
Actually, I'd consider it great form.
> Here is a working solution
> to this problem I have found.
>
>
> - Create an rc file, for this example called .myrc, with this entry:
> pixmap_path: "/tmp"
>
> - Add this call immediately BEFORE gtk_init():
> gtk_rc_add_default_file("./.myrc");
>
> - Get a pointer to the GTK settings context:
> settings = gtk_settings_get_default();
>
> - Add this call to resolve the full path to the pixmap file:
> xpm_file = gtk_rc_find_pixmap_in_path(settings, NULL, "info.xpm");
>
> - Finally, use your pixmap file:
> image = gtk_image_new_from_file(xpm_file);
> gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 3);
> g_free(xpm_file);
>
> Doing this works. Given I'm still learning the details of GTK, there
> are likely better solutions yet. Adding any example of how to accomplish
> this to the GTK examples would be extremely helpful.
The basic problem here is that you are trying to use the pixmap
path for something that it isn't meant for... it's really meant
solely for locating images for themes.
Simply do:
char *filename = g_build_filename (place_where_I_installed_my_pixmaps,
"info.png",
NULL);
image = gtk_image_new_from_file (filename);
g_free (filename);
Regards,
Owen
[ P.S. - XPM should be avoided. Use PNG instead ]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]