Custom icons and Gtk::IconTheme



Hi,
I'm trying to imagine how to update the custom icons in my program when user change the icons theme.
I have something like this:

// This are private members in TestIcons class
Glib::RefPtr<Gtk::IconTheme> icon_theme;
Glib::RefPtr<Gdk::Pixbuf> pixbuf;

// Test icons constructor
TestIcons::TestIcons(){
    icon_theme = Gtk::IconTheme::get_default();

    // Create a pixbuf from a stock icon
    pixbuf = icon_theme->load_icon("stock_calendar", 48, Gtk::ICON_LOOKUP_USE_BUILTIN);
    // Add the new pixbuf as a new icon with a custom method
    addStockIcon(pixbuf, "test-customicon", "test-customicon");

    // Connect changed signal of IconTheme
    icon_theme->signal_changed().connect(sigc::mem_fun(*this, &TestIcons::onThemeChanged));
}

TestIcons::addStockIcon(...){
...
}

TestIcons::onThemeChanged(void){
    /*
     * What sould I write here???
     */
}


--
jamf
gelide.sf.net


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