Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / widgets / icon.cpp
index 570502253cc7601e241cd4883b7847d8123223ec..15900d340c1e27969a35cb6d1dba2f2abc78710e 100644 (file)
@@ -5,6 +5,7 @@
  * Author:
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2002 Lauris Kaplinski
  *
@@ -219,7 +220,7 @@ void sp_icon_fetch_pixbuf( SPIcon *icon )
     }
 }
 
-static GdkPixbuf* renderup( gchar const* name, Inkscape::IconSize lsize, unsigned psize ) {
+GdkPixbuf* renderup( gchar const* name, Inkscape::IconSize lsize, unsigned psize ) {
     GtkIconTheme *theme = gtk_icon_theme_get_default();
 
     GdkPixbuf *pb = 0;
@@ -1109,7 +1110,7 @@ static guchar *load_svg_pixels(gchar const *name,
 
             //g_message("Loaded icon file %s", doc_filename);
             // prep the document
-            doc->ensure_up_to_date();
+            doc->ensureUpToDate();
             /* Create new arena */
             NRArena *arena = NRArena::create();
             /* Create ArenaItem and set transform */
@@ -1135,7 +1136,7 @@ static guchar *load_svg_pixels(gchar const *name,
             ==7014==    by 0x5E9DDE: nr_arena_group_render(_cairo*, NRArenaItem*, NRRectL*, NRPixBlock*, unsigned int) (nr-arena-group.cpp:228)
             ==7014==    by 0x5E72FB: nr_arena_item_invoke_render(_cairo*, NRArenaItem*, NRRectL const*, NRPixBlock*, unsigned int) (nr-arena-item.cpp:578)
             */
-            root = SP_ITEM(SP_DOCUMENT_ROOT(doc))->invoke_show(arena, visionkey, SP_ITEM_SHOW_DISPLAY );
+            root = SP_ITEM(doc->getRoot())->invoke_show(arena, visionkey, SP_ITEM_SHOW_DISPLAY );
 
             // store into the cache
             info = new svg_doc_cache_t;
@@ -1183,7 +1184,8 @@ void Inkscape::queueIconPrerender( Glib::ustring const &name, Inkscape::IconSize
 {
     GtkStockItem stock;
     gboolean stockFound = gtk_stock_lookup( name.c_str(), &stock );
-    if (!stockFound && !gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), name.c_str()) ) {
+    gboolean themedFound = gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), name.c_str());
+    if (!stockFound && !themedFound ) {
         gint trySize = CLAMP( static_cast<gint>(lsize), 0, static_cast<gint>(G_N_ELEMENTS(iconSizeLookup) - 1) );
         if ( !sizeMapDone ) {
             injectCustomSize();
@@ -1348,7 +1350,9 @@ static void addPreRender( GtkIconSize lsize, gchar const *name )
 }
 
 gboolean icon_prerender_task(gpointer /*data*/) {
-    if (!pendingRenders.empty()) {
+    if ( inkscapeIsCrashing() ) {
+        // stop
+    } else if (!pendingRenders.empty()) {
         bool workDone = false;
         do {
             preRenderItem single = pendingRenders.front();
@@ -1358,7 +1362,7 @@ gboolean icon_prerender_task(gpointer /*data*/) {
         } while (!pendingRenders.empty() && !workDone);
     }
 
-    if (!pendingRenders.empty()) {
+    if (!inkscapeIsCrashing() && !pendingRenders.empty()) {
         return TRUE;
     } else {
         callbackHooked = false;
@@ -1439,4 +1443,4 @@ static void imageMapNamedCB(GtkWidget* widget, gpointer user_data) {
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :