Problems with IconTheme



Hello,

I'm trying to use Gtk::IconTheme to get some icons from
the /usr/share/icons themes, but it's not behaving at all.

The attached example program shows three problems:
      * get_search_path() segfaults
      * get_example_icon_name() and list_icons("mimetypes") return empty
      * set_custom_theme("gnome") segfaults with the message
        "Gtk-CRITICAL **: gtk_icon_theme_set_custom_theme: assertion `!
        priv->is_screen_singleton' failed"

Am I missing something fundamental about how IconTheme is supposed to be
used?

John
#include <gtkmm.h>
#include <gtkmm/icontheme.h>

#include <iostream>
#include <vector>

int main(int argc, char **argv)
{
	Gtk::Main kit(argc, argv);
	
	static Glib::RefPtr<Gtk::IconTheme> theme = Gtk::IconTheme::get_default();
	theme->set_custom_theme("gnome");

	std::vector<Glib::ustring> icons = theme->list_icons("mimetypes");
	for (std::vector<Glib::ustring>::iterator it = icons.begin(); it != icons.end(); ++it) {
		std::cerr << (*it) << "\n";
	}

	std::vector<Glib::ustring> paths = theme->get_search_path();
	for (std::vector<Glib::ustring>::iterator it = paths.begin(); it != paths.end(); ++it) {
		std::cerr << (*it) << "\n";
	}

	std::cerr << theme->get_example_icon_name() << "\n";

}


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