From: joncruz Date: Fri, 3 Apr 2009 08:23:20 +0000 (+0000) Subject: Add XDG locations for icons X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3dd7292a3f23ac0b771374df8c275eeeea665ac4;p=inkscape.git Add XDG locations for icons --- diff --git a/src/main.cpp b/src/main.cpp index b5ace5405..db3255cad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -877,6 +877,16 @@ snooper(GdkEvent *event, gpointer /*data*/) { gtk_main_do_event (event); } +static std::vector getDirectorySet(const gchar* userDir, const gchar* const * systemDirs) { + std::vector listing; + listing.push_back(userDir); + for ( const char* const* cur = systemDirs; *cur; cur++ ) + { + listing.push_back(*cur); + } + return listing; +} + int sp_main_gui(int argc, char const **argv) { @@ -886,6 +896,19 @@ sp_main_gui(int argc, char const **argv) int retVal = sp_common_main( argc, argv, &fl ); g_return_val_if_fail(retVal == 0, 1); + // Add possible icon entry directories + std::vector dataDirs = getDirectorySet( g_get_user_data_dir(), + g_get_system_data_dirs() ); + for (std::vector::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) + { + std::vector listing; + listing.push_back(*it); + listing.push_back("inkscape"); + listing.push_back("icons"); + Glib::ustring dir = Glib::build_filename(listing); + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), dir.c_str()); + } + // Add our icon directory to the search path for icon theme lookups. gchar *usericondir = profile_path("icons"); gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), usericondir);