Code

Fixing as per discussion in LP # 179988
[inkscape.git] / src / extension / input.cpp
index 68eb31e7bb0acfc0f6cd9d1cb851a9dd7c7d6492..cdc4f32f4f288db3b511c2c9b779ecec80c52175 100644 (file)
@@ -44,7 +44,7 @@ Input::Input (Inkscape::XML::Node * in_repr, Implementation::Implementation * in
     extension = NULL;
     filetypename = NULL;
     filetypetooltip = NULL;
-       output_extension = NULL;
+    output_extension = NULL;
 
     if (repr != NULL) {
         Inkscape::XML::Node * child_repr;
@@ -94,8 +94,8 @@ Input::Input (Inkscape::XML::Node * in_repr, Implementation::Implementation * in
 }
 
 /**
-       \return  None
-       \brief   Destroys an Input extension
+    \return  None
+    \brief   Destroys an Input extension
 */
 Input::~Input (void)
 {
@@ -103,44 +103,44 @@ Input::~Input (void)
     g_free(extension);
     g_free(filetypename);
     g_free(filetypetooltip);
-       g_free(output_extension);
+    g_free(output_extension);
     return;
 }
 
 /**
     \return  Whether this extension checks out
-       \brief   Validate this extension
+    \brief   Validate this extension
 
-       This function checks to make sure that the input extension has
-       a filename extension and a MIME type.  Then it calls the parent
-       class' check function which also checks out the implmentation.
+    This function checks to make sure that the input extension has
+    a filename extension and a MIME type.  Then it calls the parent
+    class' check function which also checks out the implmentation.
 */
 bool
 Input::check (void)
 {
-       if (extension == NULL)
-               return FALSE;
-       if (mimetype == NULL)
-               return FALSE;
+    if (extension == NULL)
+        return FALSE;
+    if (mimetype == NULL)
+        return FALSE;
 
-       return Extension::check();
+    return Extension::check();
 }
 
 /**
     \return  A new document
-       \brief   This function creates a document from a file
-       \param   uri  The filename to create the document from
-
-       This function acts as the first step in creating a new document
-       from a file.  The first thing that this does is make sure that the
-       file actually exists.  If it doesn't, a NULL is returned.  If the
-       file exits, then it is opened using the implmentation of this extension.
-
-       After opening the document the output_extension is set.  What this
-       accomplishes is that save can try to use an extension that supports
-       the same fileformat.  So something like opening and saveing an 
-       Adobe Illustrator file can be transparent (not recommended, but
-       transparent).  This is all done with undo being turned off.
+    \brief   This function creates a document from a file
+    \param   uri  The filename to create the document from
+
+    This function acts as the first step in creating a new document
+    from a file.  The first thing that this does is make sure that the
+    file actually exists.  If it doesn't, a NULL is returned.  If the
+    file exits, then it is opened using the implmentation of this extension.
+
+    After opening the document the output_extension is set.  What this
+    accomplishes is that save can try to use an extension that supports
+    the same fileformat.  So something like opening and saveing an 
+    Adobe Illustrator file can be transparent (not recommended, but
+    transparent).  This is all done with undo being turned off.
 */
 SPDocument *
 Input::open (const gchar *uri)
@@ -153,20 +153,11 @@ Input::open (const gchar *uri)
     }
     timer->touch();
 
-    SPDocument * doc = NULL;
-
-#ifdef WITH_GNOME_VFS
-    doc = imp->open(this, uri);
-#else
-    if (Inkscape::IO::file_test(uri, G_FILE_TEST_EXISTS)) {
-        doc = imp->open(this, uri);
-    }
-#endif
-    
+    SPDocument *const doc = imp->open(this, uri);
     if (doc != NULL) {
         Inkscape::XML::Node * repr = sp_document_repr_root(doc);
-        gboolean saved = sp_document_get_undo_sensitive(doc);
-        sp_document_set_undo_sensitive (doc, FALSE);
+        bool saved = sp_document_get_undo_sensitive(doc);
+        sp_document_set_undo_sensitive (doc, false);
         repr->setAttribute("inkscape:output_extension", output_extension);
         sp_document_set_undo_sensitive (doc, saved);
     }
@@ -176,7 +167,7 @@ Input::open (const gchar *uri)
 
 /**
     \return  IETF mime-type for the extension
-       \brief   Get the mime-type that describes this extension
+    \brief   Get the mime-type that describes this extension
 */
 gchar *
 Input::get_mimetype(void)
@@ -186,7 +177,7 @@ Input::get_mimetype(void)
 
 /**
     \return  Filename extension for the extension
-       \brief   Get the filename extension for this extension
+    \brief   Get the filename extension for this extension
 */
 gchar *
 Input::get_extension(void)
@@ -196,7 +187,7 @@ Input::get_extension(void)
 
 /**
     \return  The name of the filetype supported
-       \brief   Get the name of the filetype supported
+    \brief   Get the name of the filetype supported
 */
 gchar *
 Input::get_filetypename(void)
@@ -209,7 +200,7 @@ Input::get_filetypename(void)
 
 /**
     \return  Tooltip giving more information on the filetype
-       \brief   Get the tooltip for more information on the filetype
+    \brief   Get the tooltip for more information on the filetype
 */
 gchar *
 Input::get_filetypetooltip(void)
@@ -219,16 +210,19 @@ Input::get_filetypetooltip(void)
 
 /**
     \return  A dialog to get settings for this extension
-       \brief   Create a dialog for preference for this extension
+    \brief   Create a dialog for preference for this extension
 
-       Calls the implementation to get the preferences.
+    Calls the implementation to get the preferences.
 */
 bool
 Input::prefs (const gchar *uri)
 {
-    if (!loaded())
+    if (!loaded()) {
         set_state(Extension::STATE_LOADED);
-    if (!loaded()) return false;
+    }
+    if (!loaded()) {
+        return false;
+    }
 
     Gtk::Widget * controls;
     controls = imp->prefs_input(this, uri);