Code

Prevent context menu and keyboard shortcuts from interrupting grabs
[inkscape.git] / src / inkview.cpp
index ade2b6d427d39f43ead661870e785dbd7f98e6a3..c151991dd8f469721d6c6b6bd9176f944bc0fbf0 100644 (file)
@@ -63,7 +63,7 @@
 #include "svg-view-widget.h"
 
 #ifdef WITH_INKJAR
-#include "inkjar/jar.h"
+#include "io/inkjar.h"
 #endif
 
 #include "inkscape-private.h"
@@ -178,6 +178,9 @@ main (int argc, const char **argv)
        usage();
     }
 
+    // Prevents errors like "Unable to wrap GdkPixbuf..." (in nr-filter-image.cpp for example)
+    Gtk::Main::init_gtkmm_internals();
+
     Gtk::Main main_instance (&argc, const_cast<char ***>(&argv));
 
     struct SPSlideShow ss;
@@ -186,20 +189,20 @@ main (int argc, const char **argv)
         num_parsed_options = 0;
 
     // the list of arguments is in the net line
-    while ((option = getopt(argc, (char* const* )argv, "t:")) != -1) 
+    while ((option = getopt(argc, (char* const* )argv, "t:")) != -1)
     {
         switch(option) {
            case 't': // for timer
                 // fprintf(stderr, "set timer arg %s\n", optarg );
-               ss.timer = atoi(optarg);        
+               ss.timer = atoi(optarg);
                num_parsed_options += 2; // 2 because of flag + option
                 break;
             case '?':
             default:
                usage();
-        }      
+        }
     }
-   
+
     GtkWidget *w;
     int i;
 
@@ -210,7 +213,7 @@ main (int argc, const char **argv)
     LIBXML_TEST_VERSION
 
     Inkscape::GC::init();
-    Inkscape::Preferences::loadSkeleton();
+    Inkscape::Preferences::get(); // ensure preferences are initialized
 
     gtk_init (&argc, (char ***) &argv);
 
@@ -234,8 +237,7 @@ main (int argc, const char **argv)
     ss.fullscreen = false;
 
     inkscape = (Inkscape::Application *)g_object_new (SP_TYPE_INKSCAPE, NULL);
-    Inkscape::Preferences::load();
-    
+
     // starting at where the commandline options stopped parsing because
     // we want all the files to be in the list
     for (i = num_parsed_options + 1 ; i < argc; i++) {
@@ -324,7 +326,7 @@ main (int argc, const char **argv)
     sp_document_ensure_up_to_date (ss.doc);
     ss.view = sp_svg_view_widget_new (ss.doc);
     sp_document_unref (ss.doc);
-    sp_svg_view_widget_set_resize (SP_SVG_VIEW_WIDGET (ss.view), FALSE, 
+    sp_svg_view_widget_set_resize (SP_SVG_VIEW_WIDGET (ss.view), FALSE,
                                    sp_document_width (ss.doc), sp_document_height (ss.doc));
     gtk_widget_show (ss.view);
     gtk_container_add (GTK_CONTAINER (w), ss.view);
@@ -444,9 +446,6 @@ sp_svgview_set_document(struct SPSlideShow *ss, SPDocument *doc, int current)
     if (doc && doc != ss->doc) {
         sp_document_ensure_up_to_date (doc);
         reinterpret_cast<SPSVGView*>(SP_VIEW_WIDGET_VIEW (ss->view))->setDocument (doc);
-        if (ss->doc) {
-            delete ss->doc;
-        }
         ss->doc = doc;
         ss->current = current;
     }
@@ -466,7 +465,7 @@ sp_svgview_show_next (struct SPSlideShow *ss)
     sp_svgview_set_document(ss, doc, current);
 
     sp_svgview_normal_cursor(ss);
-} 
+}
 
 static void
 sp_svgview_show_prev (struct SPSlideShow *ss)
@@ -492,7 +491,7 @@ sp_svgview_goto_first (struct SPSlideShow *ss)
     SPDocument *doc = NULL;
     int current = 0;
     while ( !doc && (current < ss->length - 1)) {
-        if (current == ss->current) 
+        if (current == ss->current)
             break;
         doc = sp_document_new (ss->slides[current++], TRUE, false);
     }
@@ -510,7 +509,7 @@ sp_svgview_goto_last (struct SPSlideShow *ss)
     SPDocument *doc = NULL;
     int current = ss->length - 1;
     while (!doc && (current >= 0)) {
-        if (current == ss->current) 
+        if (current == ss->current)
             break;
         doc = sp_document_new (ss->slides[current--], TRUE, false);
     }
@@ -555,7 +554,6 @@ void inkscape_ref (void) {}
 void inkscape_unref (void) {}
 void inkscape_add_document (SPDocument *document) {}
 void inkscape_remove_document (SPDocument *document) {}
-Inkscape::XML::Node *inkscape_get_repr (Inkscape::Application *inkscape, const gchar *key) {return NULL;}
 #endif