Re: Gtk::Entry Icon



2011/3/18 Andrew <rugby471 gmail com>:
> On 18/03/11 07:37, Andrew wrote:
>> On 17/03/11 18:57, Krzesimir Nowak wrote:
>>> 2011/3/17 Andrew <rugby471 gmail com>:
>>>> Hi,
>>>>
>>>> I have a Gtk::Entry that has an icon at the end
>>>> (Gtk::ENTRY_ICON_SECONDARY) and I set it to be Gtk::Stock::CLEAR
>>>>
>>>> Now I want to remove this icon. In C, I do this by passing NULL to
>>>> gtk_entry_set_icon_from_stock(). Reading the documentation at [1], I
>>>> gather that I should pass zero to achieve this same effect. However when
>>>> I do this, I receive the error:
>>>>
>>>> [Code]
>>>> set_icon_from_stock(0, Gtk::ENTRY_ICON_SECONDARY);
>>>>
>>>> [Error]
>>>> ui/dialog/ocaldialogs.cpp: In constructor
>>>> ‘Inkscape::UI::Dialog::OCAL::SearchEntry::SearchEntry(Glib::ustring)’:
>>>>
>>>> ui/dialog/ocaldialogs.cpp:292: error: no matching function for call to
>>>> ‘Inkscape::UI::Dialog::OCAL::SearchEntry::set_icon_from_stock(int,
>>>> Gtk::EntryIconPosition)’
>>>>
>>>> /usr/include/gtkmm-2.4/gtkmm/entry.h:625: note: candidates are: void
>>>> Gtk::Entry::set_icon_from_stock(const Gtk::StockID&, Gtk::EntryIconPosition)
>>>>
>>>>
>>>> How can I achieve this in gtkmm?
>>>>
>>>
>>> Use Gtk::Entry::unset_icon(Gtk::EntryIconPosition).
>
>  Sorry, but when I use that I get (correct error message this time):
>
>  error: ‘unset_icon’ was not declared in this scope
>

Hm, maybe unset_icon() method was added in later version.
Then try doing it in sort of C way with C++ method:

set_icon_from_pixbuf(Glib::RefPtr<Gdk::Pixbuf>(), Gtk::ENTRY_ICON_SECONDARY);

Glib::RefPtr<Gdk::Pixbuf>() is an empty refptr, which is a glibmm's
NULL pointer, so it should unset an icon.

> --
> Andrew
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>


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