Re: using personal icons in the GtkScaleButton



Any idea?

2010/5/30 John Williams <asb1231 gmail com>:
> Don't work. Using gtk_button_new_from_stock I got no image in the
> button, just the label "my-icon". Using gtk_scale_button_new I got
> Segmentation fault again.
>
> Code:
>    iconFactory = gtk_icon_factory_new();
>
>    gtk_icon_factory_add(iconFactory, "my-icon",
> gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_file("icon.jpg",
> &error)));
>
>    gtk_icon_factory_add_default(iconFactory);
>
>    if(error)
>    {
>        g_print("\n%s", error->message);
>    }
>
>    scaleButton3 = gtk_button_new_from_stock("my-icon");
>
> 2010/5/30 Tristan Van Berkom <tvb gnome org>:
>> On Sun, May 30, 2010 at 6:52 PM, Tristan Van Berkom <tvb gnome org> wrote:
>>> On Sun, May 30, 2010 at 6:27 PM, John Williams <asb1231 gmail com> wrote:
>>>> Ok, but how should I to do this?
>>>>
>>>> I tried this:
>>>>
>>>>    gtk_icon_factory_add(iconFactory, "my-icon",
>>>> gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_file("icon.jpg",
>>>> &error)));
>>>>
>>>>    if(error)
>>>>    {
>>>>        g_print("\n%s", error->message);
>>>>    }
>>>>
>>>>    scaleButton3 = gtk_scale_button_new(GTK_ICON_SIZE_LARGE_TOOLBAR,
>>>> 0, 1, 1, "my-icon");;
>>>>
>>>> But I have Segmentation fault when use "my-icon" at the
>>>> gtk_scale_button_new(). If I use NULL it work right. I have substitute
>>>> gtk_scale_button_new for gtk_button_new_from_stock("my-icon") and
>>>> works fine, but don't show my image, just show the label "my-icon".
>>>>
>>>> What I'm doing wrong?
>>>>
>>>
>>> Hmmm, looks like your doing /something/ wrong and so is the scale
>>> button for segfaulting instead of showing "my-icon" or something as a fallback.
>>>
>>> I think you'
>>
>> Oops that sent in mid-sentence...
>>
>> I was saying, I think you're missing a call to gtk_icon_factory_add_default().
>>
>> Cheers,
>>      -Tristan
>>
>>>
>>>> 2010/5/26 Tristan Van Berkom <tvb gnome org>:
>>>>> On Wed, May 26, 2010 at 9:24 PM, John Williams <asb1231 gmail com> wrote:
>>>>>> Anyone?
>>>>>>
>>>>>> 2010/5/25 John Williams <asb1231 gmail com>:
>>>>>>> Is possible use images from file in the GtkScaleButton as the images
>>>>>>> set by gtk_scale_button_set_icons?
>>>>>>>
>>>>>
>>>>> You should be able to just use the names of the icons
>>>>> defined by a GtkIconFactory you create.
>>>>>
>>>>> Although from reading those docs I'm not sure if the name strings
>>>>> will be searched from the icon theme or from the stock.
>>>>>
>>>>> Cheers,
>>>>>         -Tristan
>>>>>
>>>>
>>>
>>
>


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