[Glade-users] Right way to do custom icons?
Tristan Van Berkom
tristan.van.berkom at gmail.com
Sat Mar 14 18:54:08 EDT 2009
Use GtkIconFactory / stock property for the said button.
Glade 3.6 with GtkBuilder lets you define the icon factory (and icon
sources) in Glade.
I will release 3.6 on monday (GNOME 2.26 deadline), regardless of the few
annoying bugs I really didnt find time to fix yet.
Cheers,
-Tristan
On Sat, Mar 14, 2009 at 12:05 PM, Jonathan Lane <lanej at horizon.com> wrote:
> Right now in my applications I'm just loading my custom pixmaps in and
> applying them with:
>
> iconpb = gdk_pixbuf_new_from_file_at_size(iconf, iconsz, iconsz,
> &gerr);
> if (iconpb == NULL) {
> LOGF(0, "failed to load icon '%s': %s", iconf, gerr->message);
> return;
> }
> iconw = gtk_image_new_from_pixbuf(iconpb);
> g_object_unref(iconpb);
> gtk_widget_show(iconw);
> gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(button), iconw);
>
> Where iconsz is either 16 or 32, hardcoded.
>
> Obviously the problem with this is that I'm not respecting the user's
> global preferences for toolbar icon size and label visibility/position.
>
> Does anyone have any links to sample code or tutorials to do this The
> Right Way?
>
> Thanks in advance,
> Jonathan
> _______________________________________________
> Glade-users maillist - Glade-users at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users
>
More information about the Glade-users
mailing list