aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-shell.c94
-rw-r--r--embed/ephy-embed-shell.h22
-rw-r--r--embed/mozilla/ContentHandler.cpp5
-rw-r--r--embed/mozilla/ContentHandler.h2
4 files changed, 11 insertions, 112 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 0051be195..4802438a0 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -32,19 +32,15 @@
#include "ephy-encodings.h"
#include "ephy-debug.h"
-#include <libxml/xmlreader.h>
-#include <string.h>
-
#define EPHY_EMBED_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellPrivate))
-struct EphyEmbedShellPrivate
+struct _EphyEmbedShellPrivate
{
EphyHistory *global_history;
DownloaderView *downloader_view;
EphyFaviconCache *favicon_cache;
EphyEmbedSingle *embed_single;
EphyEncodings *encodings;
- GHashTable *mime_table;
};
static void ephy_embed_shell_class_init (EphyEmbedShellClass *klass);
@@ -120,12 +116,6 @@ ephy_embed_shell_finalize (GObject *object)
g_object_unref (G_OBJECT (shell->priv->embed_single));
}
- LOG ("Destroying mime type hashtable")
- if (shell->priv->mime_table)
- {
- g_hash_table_destroy (shell->priv->mime_table);
- }
-
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -207,88 +197,6 @@ ephy_embed_shell_get_encodings (EphyEmbedShell *shell)
}
static void
-load_mime_from_xml (EphyEmbedShell *shell)
-{
- xmlTextReaderPtr reader;
- const char *xml_file;
- int ret;
- EphyMimePermission permission = EPHY_MIME_PERMISSION_UNKNOWN;
-
- xml_file = ephy_file ("mime-types-permissions.xml");
- if (xml_file == NULL)
- {
- g_warning ("MIME types permissions file not found!\n");
- return;
- }
-
- reader = xmlNewTextReaderFilename (xml_file);
- if (reader == NULL)
- {
- g_warning ("Could not load MIME types permissions file!\n");
- return;
- }
-
- ret = xmlTextReaderRead (reader);
- while (ret == 1)
- {
- const xmlChar *tag;
- xmlReaderTypes type;
-
- tag = xmlTextReaderConstName (reader);
- type = xmlTextReaderNodeType (reader);
-
- if (xmlStrEqual (tag, "safe") && type == XML_READER_TYPE_ELEMENT)
- {
- permission = EPHY_MIME_PERMISSION_SAFE;
- }
- else if (xmlStrEqual (tag, "unsafe") && type == XML_READER_TYPE_ELEMENT)
- {
- permission = EPHY_MIME_PERMISSION_UNSAFE;
- }
- else if (xmlStrEqual (tag, "mime-type"))
- {
- xmlChar *type;
-
- type = xmlTextReaderGetAttribute (reader, "type");
- g_hash_table_insert (shell->priv->mime_table,
- type, GINT_TO_POINTER (permission));
- }
-
- ret = xmlTextReaderRead (reader);
- }
-
- xmlFreeTextReader (reader);
-}
-
-EphyMimePermission
-ephy_embed_shell_check_mime (EphyEmbedShell *shell, const char *mime_type)
-{
- EphyMimePermission permission;
- gpointer tmp;
-
- g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), EPHY_MIME_PERMISSION_UNKNOWN);
-
- if (shell->priv->mime_table == NULL)
- {
- shell->priv->mime_table = g_hash_table_new_full
- (g_str_hash, g_str_equal, xmlFree, NULL);
- load_mime_from_xml (shell);
- }
-
- tmp = g_hash_table_lookup (shell->priv->mime_table, mime_type);
- if (tmp == NULL)
- {
- permission = EPHY_MIME_PERMISSION_UNKNOWN;
- }
- else
- {
- permission = GPOINTER_TO_INT (tmp);
- }
-
- return permission;
-}
-
-static void
ephy_embed_shell_init (EphyEmbedShell *shell)
{
shell->priv = EPHY_EMBED_SHELL_GET_PRIVATE (shell);
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index cc2febf60..4eb3234a9 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -33,20 +33,13 @@ G_BEGIN_DECLS
#define EPHY_IS_EMBED_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED_SHELL))
#define EPHY_EMBED_SHELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellClass))
-typedef struct EphyEmbedShellClass EphyEmbedShellClass;
-typedef struct EphyEmbedShell EphyEmbedShell;
-typedef struct EphyEmbedShellPrivate EphyEmbedShellPrivate;
+typedef struct _EphyEmbedShellClass EphyEmbedShellClass;
+typedef struct _EphyEmbedShell EphyEmbedShell;
+typedef struct _EphyEmbedShellPrivate EphyEmbedShellPrivate;
extern EphyEmbedShell *embed_shell;
-typedef enum
-{
- EPHY_MIME_PERMISSION_SAFE = 1,
- EPHY_MIME_PERMISSION_UNSAFE = 2,
- EPHY_MIME_PERMISSION_UNKNOWN = 3
-} EphyMimePermission;
-
-struct EphyEmbedShell
+struct _EphyEmbedShell
{
GObject parent;
@@ -54,7 +47,7 @@ struct EphyEmbedShell
EphyEmbedShellPrivate *priv;
};
-struct EphyEmbedShellClass
+struct _EphyEmbedShellClass
{
GObjectClass parent_class;
};
@@ -71,9 +64,6 @@ GObject *ephy_embed_shell_get_encodings (EphyEmbedShell *shell);
GObject *ephy_embed_shell_get_embed_single (EphyEmbedShell *shell);
-EphyMimePermission ephy_embed_shell_check_mime (EphyEmbedShell *shell,
- const char *mime_type);
-
G_END_DECLS
-#endif
+#endif /* !EPHY_EMBED_SHELL_H */
diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp
index 14a3438ec..0b7f2f653 100644
--- a/embed/mozilla/ContentHandler.cpp
+++ b/embed/mozilla/ContentHandler.cpp
@@ -49,6 +49,7 @@
#include "ephy-embed-single.h"
#include "ephy-embed-shell.h"
#include "ephy-file-chooser.h"
+#include "ephy-file-helpers.h"
#include "ephy-stock-icons.h"
#include "ephy-gui.h"
#include "ephy-debug.h"
@@ -326,10 +327,10 @@ NS_METHOD GContentHandler::MIMEInitiateAction (void)
#ifdef MOZ_NSIMIMEINFO_NSACSTRING_
mHelperApp = gnome_vfs_mime_get_default_application (mMimeType.get());
- mPermission = ephy_embed_shell_check_mime (embed_shell, mMimeType.get());
+ mPermission = ephy_file_check_mime (mMimeType.get());
#else
mHelperApp = gnome_vfs_mime_get_default_application (mMimeType);
- mPermission = ephy_embed_shell_check_mime (embed_shell, mMimeType);
+ mPermission = ephy_file_check_mime (mMimeType);
#endif
if (auto_downloads)
diff --git a/embed/mozilla/ContentHandler.h b/embed/mozilla/ContentHandler.h
index 9f11bb67a..3401a68cb 100644
--- a/embed/mozilla/ContentHandler.h
+++ b/embed/mozilla/ContentHandler.h
@@ -24,7 +24,7 @@
#include "config.h"
-#include "ephy-embed-shell.h"
+#include "ephy-file-helpers.h"
#include <libgnomevfs/gnome-vfs-mime-handlers.h>