Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marcopg@litl.com>2009-03-16 14:09:25 (GMT)
committer Marco Pesenti Gritti <marcopg@litl.com>2010-07-27 22:04:20 (GMT)
commita528c5b40534b666dfdf1bcd4736786d4034fc2e (patch)
tree47ec4b811227e1e33d3e41d7487d026c233a9330
parentce47ec697f381c026e7e0fbc08c3c76dc36f495a (diff)
Cleanup loading error handling.
-rw-r--r--browser-plugin/glue.cpp7
-rw-r--r--browser-plugin/plugin.cpp12
-rw-r--r--browser-plugin/plugin.h1
3 files changed, 15 insertions, 5 deletions
diff --git a/browser-plugin/glue.cpp b/browser-plugin/glue.cpp
index 48562b4..148f566 100644
--- a/browser-plugin/glue.cpp
+++ b/browser-plugin/glue.cpp
@@ -148,7 +148,12 @@ int32 NPP_Write (NPP instance, NPStream* stream,
void NPP_StreamAsFile (NPP instance, NPStream* stream, const char* fname)
{
Plugin *plugin = reinterpret_cast<Plugin*> (instance->pdata);
- plugin->Load (fname);
+
+ if (fname != NULL) {
+ plugin->Load (fname);
+ } else {
+ plugin->ShowLoadingError ();
+ }
}
void NPP_Print (NPP instance, NPPrint* platformPrint)
diff --git a/browser-plugin/plugin.cpp b/browser-plugin/plugin.cpp
index 15f39ea..295c0f7 100644
--- a/browser-plugin/plugin.cpp
+++ b/browser-plugin/plugin.cpp
@@ -89,6 +89,12 @@ Plugin::SetWindow (GdkNativeWindow window)
}
void
+Plugin::ShowLoadingError()
+{
+ /* FIXME display loading error in the UI */
+}
+
+void
Plugin::Load (const char *fname)
{
GError *error = NULL;
@@ -97,11 +103,9 @@ Plugin::Load (const char *fname)
char *uri = g_file_get_uri (file);
g_object_unref (file);
- /* FIXME display loading error in the UI */
-
EvDocument *document = ev_document_factory_get_document (uri, &error);
if (error) {
- g_warning ("Cannot create document for %s", uri);
+ ShowLoadingError ();
g_error_free (error);
return;
}
@@ -111,7 +115,7 @@ Plugin::Load (const char *fname)
ev_document_load (document, uri, &error);
if (error) {
- g_warning ("Cannot load %s", uri);
+ ShowLoadingError ();
g_error_free (error);
return;
}
diff --git a/browser-plugin/plugin.h b/browser-plugin/plugin.h
index 281affd..a46e07b 100644
--- a/browser-plugin/plugin.h
+++ b/browser-plugin/plugin.h
@@ -37,6 +37,7 @@ class Plugin {
void ZoomOut ();
void FindNext (const char *text);
void FindPrevious (const char *text);
+ void ShowLoadingError ();
NPObject *GetScriptableNPObject ();
private: