Re: using personal icons in the GtkScaleButton



I can't believe that you think on it when are sleeping.

Your solution works perfectly! Thank you for it, and thanks for think
on it even when you're sleeping

2010/6/5, Tadej Borovšak <tadeboro gmail com>:
> Hello.
>
>> For the second option, just add the images folder to the theme search
>> patch with gtk_icon_theme_append_search_path will resolve the problem?
>
> Yes, this is all that is needed to have named icons working. Theme
> lookup mechanism will do rest of the work for you.
>
>> How, by the code, I connect the GtkIconTheme to the GtkIconFactory? Or
>> it is done automatically? I have tried:
>
> This is something you would only rarely want to do, since most of the
> time, user defined stock icons are defined directly from disk files or
> GdkPixbufs. Icon theme and stock items are for normal application two
> separate things that do not mix.
>
>
> While I was sleeping, I remembered one more way of solving your issue
> that doesn't involve copying icons into folders, expanding paths, ...
> Have a look at this application that shows you how to add icon to
> current theme with minimal fuss:
>
> #include <gtk/gtk.h>
>
> int main(int argc, char *argv[])
> {
>    GtkWidget *window, *scaleButton3;
>    GdkPixbuf *pixbuf;
>
>    gtk_init(&argc, &argv);
>
>    pixbuf = gdk_pixbuf_new_from_file ("icon.jpg", NULL);
>    gtk_icon_theme_add_builtin_icon ("my-icon",
> 				    gdk_pixbuf_get_width (pixbuf),
> 				    pixbuf);
>
>    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>    gtk_widget_set_size_request(window, 300, 175);
>
>    scaleButton3 = gtk_image_new_from_icon_name("my-icon",
> GTK_ICON_SIZE_BUTTON);
>    gtk_container_add(GTK_CONTAINER(window), scaleButton3);
>
>    gtk_widget_show_all(window);
>
>    gtk_main();
>
>    return 0;
> }
>
> This code simply registers "my-icon" name as an alias for pixbuf,
> which means that you can use that name in any function that takes
> named icon as parameter.
>
> Hopefully this will resolve your issues.
>
> Tadej
>
> --
> Tadej Borovšak
> tadeboro.blogspot.com
> tadeboro gmail com
> tadej borovsak gmail com
>


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