Code

OCAL. Fix for Bug #638844 (Errors printed to console if openclipart search fails).
[inkscape.git] / src / ui / dialog / ocaldialogs.cpp
index 729d09511c064357bb40ca01394c53e871f55fb1..2ae7d6989f05a76ed3ad5b386402d8f31ffcaee6 100644 (file)
@@ -1,7 +1,7 @@
-/**
- * Implementation of the ocal dialog interfaces defined in ocaldialog.h
- *
- * Authors:
+/** @file
+ * @brief Open Clip Art Library integration dialogs - implementation
+ */
+/* Authors:
  *   Bruno Dilly
  *   Other dudes from The Inkscape Organization
  *
@@ -25,6 +25,7 @@
 #include "gc-core.h"
 #include <dialogs/dialog-events.h>
 #include "io/sys.h"
+#include "preferences.h"
 
 namespace Inkscape
 {
@@ -40,6 +41,7 @@ namespace Dialog
 /**
  * Callback for fileNameEntry widget
  */
+/*
 void FileExportToOCALDialog::fileNameEntryChangedCallback()
 {
     if (!fileNameEntry)
@@ -52,25 +54,32 @@ void FileExportToOCALDialog::fileNameEntryChangedCallback()
     myFilename = fileName;
     response(Gtk::RESPONSE_OK);
 }
-
+*/
 /**
  * Constructor
  */
+/*
 FileExportToOCALDialog::FileExportToOCALDialog(Gtk::Window &parentWindow,
             FileDialogType fileTypes,
             const Glib::ustring &title) :
     FileDialogOCALBase(title, parentWindow)
 {
-    /*
+*/
+     /*
      * Start Taking the vertical Box and putting a Label
      * and a Entry to take the filename
      * Later put the extension selection and checkbox (?)
      */
     /* Initalize to Autodetect */
+/*
     extension = NULL;
+*/
     /* No filename to start out with */
+/*
     myFilename = "";
+*/
     /* Set our dialog type (save, export, etc...)*/
+/*
     dialogType = fileTypes;
     Gtk::VBox *vbox = get_vbox();
 
@@ -101,17 +110,19 @@ FileExportToOCALDialog::FileExportToOCALDialog(Gtk::Window &parentWindow,
 
     show_all_children();
 }
-
+*/
 /**
  * Destructor
  */
+/*
 FileExportToOCALDialog::~FileExportToOCALDialog()
 {
 }
-
+*/
 /**
  * Show this dialog modally.  Return true if user hits [OK]
  */
+/*
 bool
 FileExportToOCALDialog::show()
 {
@@ -129,10 +140,11 @@ FileExportToOCALDialog::show()
         return FALSE;
         }
 }
-
+*/
 /**
  * Get the file name chosen by the user.   Valid after an [OK]
  */
+/*
 Glib::ustring
 FileExportToOCALDialog::getFilename()
 {
@@ -149,7 +161,7 @@ FileExportToOCALDialog::change_title(const Glib::ustring& title)
 {
     this->set_title(title);
 }
-
+*/
 
 //########################################################################
 //# F I L E    E X P O R T   T O   O C A L   P A S S W O R D
@@ -159,14 +171,17 @@ FileExportToOCALDialog::change_title(const Glib::ustring& title)
 /**
  * Constructor
  */
+/*
 FileExportToOCALPasswordDialog::FileExportToOCALPasswordDialog(Gtk::Window &parentWindow,
                              const Glib::ustring &title) : FileDialogOCALBase(title, parentWindow)
 {
+*/
     /*
      * Start Taking the vertical Box and putting 2 Labels
      * and 2 Entries to take the username and password
      */
     /* No username and password to start out with */
+/*
     myUsername = "";
     myPassword = "";
 
@@ -199,18 +214,20 @@ FileExportToOCALPasswordDialog::FileExportToOCALPasswordDialog(Gtk::Window &pare
 
     show_all_children();
 }
-
+*/
 
 /**
  * Destructor
  */
+/*
 FileExportToOCALPasswordDialog::~FileExportToOCALPasswordDialog()
 {
 }
-
+*/
 /**
  * Show this dialog modally.  Return true if user hits [OK]
  */
+/*
 bool
 FileExportToOCALPasswordDialog::show()
 {
@@ -228,20 +245,22 @@ FileExportToOCALPasswordDialog::show()
         return FALSE;
     }
 }
-
+*/
 /**
  * Get the username.   Valid after an [OK]
  */
+/*
 Glib::ustring
 FileExportToOCALPasswordDialog::getUsername()
 {
     myUsername = usernameEntry->get_text();
     return myUsername;
 }
-
+*/
 /**
  * Get the password.   Valid after an [OK]
  */
+/*
 Glib::ustring
 FileExportToOCALPasswordDialog::getPassword()
 {
@@ -254,7 +273,7 @@ FileExportToOCALPasswordDialog::change_title(const Glib::ustring& title)
 {
     this->set_title(title);
 }
-
+*/
 
 //#########################################################################
 //### F I L E   I M P O R T   F R O M   O C A L
@@ -306,8 +325,9 @@ void FileListViewText::on_cursor_changed()
     //get file url
     fileUrl = get_text(posArray[0], 1); //http url
 
+    //Inkscape::Preferences *prefs = Inkscape::Preferences::get();
     //Glib::ustring fileUrl = "dav://"; //dav url
-    //fileUrl.append(prefs_get_string_attribute("options.ocalurl", "str"));
+    //fileUrl.append(prefs->getString("/options/ocalurl/str"));
     //fileUrl.append("/dav.php/");
     //fileUrl.append(get_text(posArray[0], 3)); //author dir
     //fileUrl.append("/");
@@ -418,11 +438,12 @@ void FileImportFromOCALDialog::searchTagEntryChangedCallback()
 
     notFoundLabel->hide();
     descriptionLabel->set_text("");
+    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
 
     Glib::ustring searchTag = searchTagEntry->get_text();
     // create the ocal uri to get rss feed
     Glib::ustring uri = "http://";
-    uri.append(prefs_get_string_attribute("options.ocalurl", "str"));
+    uri.append(prefs->getString("/options/ocalurl/str"));
     uri.append("/media/feed/rss/");
     uri.append(searchTag);
     if (!Glib::get_charset()) //If we are not utf8
@@ -449,7 +470,7 @@ void FileImportFromOCALDialog::searchTagEntryChangedCallback()
 
     doc = xmlReadIO ((xmlInputReadCallback) vfs_read_callback,
         (xmlInputCloseCallback) gnome_vfs_close, from_handle, uri.c_str(), NULL,
-        XML_PARSE_RECOVER);
+        XML_PARSE_RECOVER + XML_PARSE_NOWARNING + XML_PARSE_NOERROR);
     if (doc == NULL) {
         sp_ui_error_dialog(_("Server supplied malformed Clip Art feed"));
         g_warning("Failed to parse %s\n", uri.c_str());