aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-02-06 04:28:09 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-02-06 04:28:09 +0800
commit768eae4a4874a7fe0eada98423f61d84f6416bde (patch)
tree707977820ddbc47121fb107c8569cbb5bb2ef566 /embed
parent4e522c23a0650605cf8270f381ca10f2f35bbf78 (diff)
downloadgsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.gz
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.bz2
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.lz
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.xz
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.tar.zst
gsoc2013-epiphany-768eae4a4874a7fe0eada98423f61d84f6416bde.zip
*** empty log message ***
Diffstat (limited to 'embed')
-rw-r--r--embed/Makefile.am2
-rw-r--r--embed/ephy-embed-event.h1
-rw-r--r--embed/ephy-embed-shell.c196
-rw-r--r--embed/ephy-embed-shell.h186
-rw-r--r--embed/ephy-embed-utils.c28
-rw-r--r--embed/ephy-embed.c6
-rw-r--r--embed/ephy-embed.h2
-rw-r--r--embed/mozilla/ContentHandler.h2
-rw-r--r--embed/mozilla/EventContext.cpp4
-rw-r--r--embed/mozilla/GlobalHistory.cpp2
-rw-r--r--embed/mozilla/Makefile.am13
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp24
-rw-r--r--embed/mozilla/PromptService.cpp1
-rw-r--r--embed/mozilla/mozilla-embed-shell.h55
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp (renamed from embed/mozilla/mozilla-embed-shell.cpp)222
-rw-r--r--embed/mozilla/mozilla-embed-single.h53
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp19
-rw-r--r--embed/mozilla/mozilla-notifiers.h4
-rw-r--r--embed/mozilla/mozilla-prefs.cpp55
-rw-r--r--embed/mozilla/mozilla-prefs.h10
20 files changed, 252 insertions, 633 deletions
diff --git a/embed/Makefile.am b/embed/Makefile.am
index 4a1568ec9..96d440d4f 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -34,6 +34,8 @@ libephyembed_la_SOURCES = \
ephy-embed-popup-control.c \
ephy-embed-popup-control.h \
ephy-embed-prefs.h \
+ ephy-embed-single.c \
+ ephy-embed-single.h \
ephy-embed-shell.c \
ephy-embed-shell.h \
ephy-embed-types.h \
diff --git a/embed/ephy-embed-event.h b/embed/ephy-embed-event.h
index 69b3818a4..3c5f3cca4 100644
--- a/embed/ephy-embed-event.h
+++ b/embed/ephy-embed-event.h
@@ -59,7 +59,6 @@ struct EphyEmbedEvent
guint modifier;
guint mouse_button;
guint context;
- guint timestamp;
guint mouse_x, mouse_y;
};
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index e4ca5bb73..3569590fa 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -21,7 +21,7 @@
#include "ephy-embed-shell.h"
#include "ephy-marshal.h"
#include "ephy-favicon-cache.h"
-#include "mozilla-embed-shell.h"
+#include "mozilla-embed-single.h"
#include "ephy-debug.h"
#include <string.h>
@@ -39,6 +39,7 @@ struct EphyEmbedShellPrivate
DownloaderView *downloader_view;
GList *embeds;
EphyFaviconCache *favicon_cache;
+ EphyEmbedSingle *embed_single;
};
static void
@@ -59,12 +60,6 @@ static guint ephy_embed_shell_signals[LAST_SIGNAL] = { 0 };
EphyEmbedShell *embed_shell;
GType
-ephy_embed_shell_get_impl (void)
-{
- return MOZILLA_EMBED_SHELL_TYPE;
-}
-
-GType
ephy_embed_shell_get_type (void)
{
static GType ephy_embed_shell_type = 0;
@@ -130,7 +125,6 @@ ephy_embed_shell_class_init (EphyEmbedShellClass *klass)
static void
ephy_embed_shell_init (EphyEmbedShell *ges)
{
-
/* Singleton, globally accessible */
embed_shell = ges;
@@ -176,6 +170,12 @@ ephy_embed_shell_finalize (GObject *object)
g_object_unref (G_OBJECT (ges->priv->favicon_cache));
}
+ LOG ("Unref embed single")
+ if (ges->priv->embed_single)
+ {
+ g_object_unref (G_OBJECT (ges->priv->embed_single));
+ }
+
g_free (ges->priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -187,7 +187,7 @@ ephy_embed_shell_new (const char *type)
if (strcmp (type, "mozilla") == 0)
{
return EPHY_EMBED_SHELL (g_object_new
- (MOZILLA_EMBED_SHELL_TYPE, NULL));
+ (EPHY_EMBED_SHELL_TYPE, NULL));
}
g_assert_not_reached ();
@@ -243,14 +243,6 @@ ephy_embed_shell_get_embeds (EphyEmbedShell *ges)
return ges->priv->embeds;
}
-void
-ephy_embed_shell_get_capabilities (EphyEmbedShell *shell,
- EmbedShellCapabilities *caps)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->get_capabilities (shell, caps);
-}
-
EphyHistory *
ephy_embed_shell_get_global_history (EphyEmbedShell *shell)
{
@@ -265,128 +257,15 @@ ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell)
return klass->get_downloader_view (shell);
}
-gresult
-ephy_embed_shell_clear_cache (EphyEmbedShell *shell,
- CacheType type)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->clear_cache (shell, type);
-}
-
-gresult
-ephy_embed_shell_set_offline_mode (EphyEmbedShell *shell,
- gboolean offline)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->set_offline_mode (shell, offline);
-}
-
-gresult
-ephy_embed_shell_load_proxy_autoconf (EphyEmbedShell *shell,
- const char* url)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->load_proxy_autoconf (shell, url);
-}
-
-gresult
-ephy_embed_shell_get_charset_titles (EphyEmbedShell *shell,
- const char *group,
- GList **charsets)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->get_charset_titles (shell, group, charsets);
-}
-
-gresult
-ephy_embed_shell_get_charset_groups (EphyEmbedShell *shell,
- GList **groups)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->get_charset_groups (shell, groups);
-}
-
-gresult
-ephy_embed_shell_get_font_list (EphyEmbedShell *shell,
- const char *langGroup,
- const char *fontType,
- GList **fontList,
- char **default_font)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->get_font_list (shell, langGroup, fontType, fontList,
- default_font);
-}
-
-gresult
-ephy_embed_shell_list_cookies (EphyEmbedShell *shell,
- GList **cookies)
+EphyEmbedSingle *
+ephy_embed_shell_get_embed_single (EphyEmbedShell *shell)
{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->list_cookies (shell, cookies);
-}
-
-gresult
-ephy_embed_shell_remove_cookies (EphyEmbedShell *shell,
- GList *cookies)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->remove_cookies (shell, cookies);
-}
-
-gresult
-ephy_embed_shell_list_passwords (EphyEmbedShell *shell,
- PasswordType type,
- GList **passwords)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->list_passwords (shell, type, passwords);
-}
+ if (!shell->priv->embed_single)
+ {
+ shell->priv->embed_single = ephy_embed_single_new ("mozilla");
+ }
-gresult
-ephy_embed_shell_remove_passwords (EphyEmbedShell *shell,
- GList *passwords,
- PasswordType type)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->remove_passwords (shell, passwords, type);
-}
-
-/**
- * show_file_picker: Shows a file picker. Can be configured to select a
- * file or a directory.
- * @parentWidget: Parent Widget for file picker.
- * @title: Title for file picker.
- * @directory: Initial directory to start in.
- * @file: Initial filename to show in filepicker.
- * @mode: Mode to run filepicker in (modeOpen, modeSave, modeGetFolder)
- * @ret_fullpath: On a successful return, will hold the full path to selected
- * file or directory.
- * @file_formats: an array of FileFormat structures to fill the format chooser
- * optionmenu. NULL if not needed. The last item must have
- * description == NULL.
- * @ret_file_format: where to store the index of the format selected (can be
- * NULL)
- * returns: TRUE for success, FALSE for failure.
- */
-
-gresult
-ephy_embed_shell_show_file_picker (EphyEmbedShell *shell,
- GtkWidget *parentWidget,
- const char *title,
- const char *directory,
- const char *file,
- FilePickerMode mode,
- char **ret_fullpath,
- gboolean *ret_save_content,
- FileFormat *file_formats,
- int *ret_file_format)
-{
- EphyEmbedShellClass *klass = EPHY_EMBED_SHELL_GET_CLASS (shell);
- return klass->show_file_picker (shell, parentWidget, title,
- directory, file, mode,
- ret_fullpath, ret_save_content,
- file_formats, ret_file_format);
+ return shell->priv->embed_single;
}
static EphyHistory *
@@ -414,46 +293,3 @@ impl_get_downloader_view (EphyEmbedShell *shell)
return shell->priv->downloader_view;
}
-gresult
-ephy_embed_shell_free_cookies (EphyEmbedShell *shell,
- GList *cookies)
-{
- GList *l;
-
- for (l = cookies; l != NULL; l = l->next)
- {
- CookieInfo *info = (CookieInfo *)l->data;
-
- g_free (info->domain);
- g_free (info->name);
- g_free (info->value);
- g_free (info->path);
- g_free (info->secure);
- g_free (info->expire);
- g_free (info);
- }
-
- g_list_free (cookies);
-
- return G_OK;
-}
-
-gresult
-ephy_embed_shell_free_passwords (EphyEmbedShell *shell,
- GList *passwords)
-{
- GList *l;
-
- for (l = passwords; l != NULL; l = l->next)
- {
- PasswordInfo *info = (PasswordInfo *)l->data;
- g_free (info->host);
- g_free (info->username);
- g_free (info);
- }
-
- g_list_free (passwords);
-
- return G_OK;
-}
-
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index e7d789d57..a5027bdfc 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -20,6 +20,7 @@
#define EPHY_EMBED_SHELL_H
#include "ephy-embed.h"
+#include "ephy-embed-single.h"
#include "ephy-favicon-cache.h"
#include "ephy-history.h"
#include "downloader-view.h"
@@ -44,87 +45,6 @@ typedef struct EphyEmbedShellPrivate EphyEmbedShellPrivate;
extern EphyEmbedShell *embed_shell;
-/**
- * FilePickerMode: What mode FilePicker should run in
- */
-
-typedef enum
-{
- modeOpen = 0,
- modeSave = 1,
- modeGetFolder =2
-} FilePickerMode;
-
-typedef struct
-{
- /* description of the file format */
- gchar *description;
- /* tipical sufixes, NULL terminated */
- gchar **extensions;
-} FileFormat;
-
-/**
- * Cookie: the type of cookies
- */
-typedef struct
-{
- gchar *domain;
- gchar *name;
- gchar *value;
- gchar *path;
- gchar *secure;
- gchar *expire;
-} CookieInfo;
-
-/**
- * Password: a password manager entry
- */
-typedef struct
-{
- gchar *host;
- gchar *username;
-} PasswordInfo;
-
-typedef struct
-{
- const char *name;
- const char *title;
-} CharsetInfo;
-
-/**
- * PasswordType: To distinguish actual passwords from blocked password sites
- */
-typedef enum
-{
- PASSWORD_PASSWORD,
- PASSWORD_REJECT
-} PasswordType;
-
-typedef enum
-{
- COOKIES_PERMISSION,
- IMAGES_PERMISSION
-} PermissionType;
-
-typedef enum
-{
- DISK_CACHE = 2,
- MEMORY_CACHE = 1
-} CacheType;
-
-typedef enum
-{
- CACHE_CLEAR_CAP = 1 << 0,
- OFFLINE_CAP = 1 << 1,
- PROXY_AUTOCONF_CAP = 1 << 2,
- JAVA_CONSOLE_CAP = 1 << 3,
- JS_CONSOLE_CAP = 1 << 4,
- CHARSETS_CAP = 1 << 5,
- COOKIES_CAP = 1 << 7,
- PASSWORDS_CAP = 1 << 8,
- FILEPICKER_CAP = 1 << 9
-} EmbedShellCapabilities;
-
struct EphyEmbedShell
{
GObject parent;
@@ -144,49 +64,8 @@ struct EphyEmbedShellClass
char *param);
/* Methods */
-
- void (* get_capabilities) (EphyEmbedShell *shell,
- EmbedShellCapabilities *caps);
- EphyHistory * (* get_global_history) (EphyEmbedShell *shell);
- DownloaderView* (* get_downloader_view) (EphyEmbedShell *shell);
- gresult (* clear_cache) (EphyEmbedShell *shell,
- CacheType type);
- gresult (* set_offline_mode) (EphyEmbedShell *shell,
- gboolean offline);
- gresult (* load_proxy_autoconf) (EphyEmbedShell *shell,
- const char* url);
- gresult (* show_java_console) (EphyEmbedShell *shell);
- gresult (* show_js_console) (EphyEmbedShell *shell);
- gresult (* get_charset_groups) (EphyEmbedShell *shell,
- GList **groups);
- gresult (* get_charset_titles) (EphyEmbedShell *shell,
- const char *group,
- GList **charsets);
- gresult (* get_font_list) (EphyEmbedShell *shell,
- const char *langGroup,
- const char *fontType,
- GList **fontList,
- char **default_font);
- gresult (* list_cookies) (EphyEmbedShell *shell,
- GList **cokies);
- gresult (* remove_cookies) (EphyEmbedShell *shell,
- GList *cookies);
- gresult (* list_passwords) (EphyEmbedShell *shell,
- PasswordType type,
- GList **passwords);
- gresult (* remove_passwords) (EphyEmbedShell *shell,
- GList *passwords,
- PasswordType type);
- gresult (* show_file_picker) (EphyEmbedShell *shell,
- GtkWidget *parentWidget,
- const char* title,
- const char* directory,
- const char* file,
- FilePickerMode mode,
- char **ret_fullpath,
- gboolean *ret_save_content,
- FileFormat *file_formats,
- gint *ret_file_format);
+ EphyHistory * (* get_global_history) (EphyEmbedShell *shell);
+ DownloaderView * (* get_downloader_view) (EphyEmbedShell *shell);
};
GType ephy_embed_shell_get_type (void);
@@ -207,68 +86,11 @@ EphyEmbed *ephy_embed_shell_get_active_embed (EphyEmbedShell *ges);
GList *ephy_embed_shell_get_embeds (EphyEmbedShell *ges);
-void ephy_embed_shell_get_capabilities (EphyEmbedShell *shell,
- EmbedShellCapabilities *caps);
-
EphyHistory *ephy_embed_shell_get_global_history (EphyEmbedShell *shell);
DownloaderView *ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell);
-gresult ephy_embed_shell_clear_cache (EphyEmbedShell *shell,
- CacheType type);
-
-gresult ephy_embed_shell_set_offline_mode (EphyEmbedShell *shell,
- gboolean offline);
-
-gresult ephy_embed_shell_load_proxy_autoconf (EphyEmbedShell *shell,
- const char* url);
-
-/* Charsets */
-gresult ephy_embed_shell_get_charset_groups (EphyEmbedShell *shell,
- GList **groups);
-
-gresult ephy_embed_shell_get_charset_titles (EphyEmbedShell *shell,
- const char *group,
- GList **charsets);
-
-gresult ephy_embed_shell_get_font_list (EphyEmbedShell *shell,
- const char *langGroup,
- const char *fontType,
- GList **fontList,
- char **default_font);
-
-/* Cookies */
-gresult ephy_embed_shell_list_cookies (EphyEmbedShell *shell,
- GList **cookies);
-
-gresult ephy_embed_shell_remove_cookies (EphyEmbedShell *shell,
- GList *cookies);
-
-gresult ephy_embed_shell_free_cookies (EphyEmbedShell *shell,
- GList *cookies);
-
-/* Passwords */
-gresult ephy_embed_shell_list_passwords (EphyEmbedShell *shell,
- PasswordType type,
- GList **passwords);
-
-gresult ephy_embed_shell_free_passwords (EphyEmbedShell *shell,
- GList *passwords);
-
-gresult ephy_embed_shell_remove_passwords (EphyEmbedShell *shell,
- GList *passwords,
- PasswordType type);
-
-gresult ephy_embed_shell_show_file_picker (EphyEmbedShell *shell,
- GtkWidget *parentWidget,
- const char *title,
- const char *directory,
- const char *file,
- FilePickerMode mode,
- char **ret_fullpath,
- gboolean *ret_save_content,
- FileFormat *file_formats,
- int *ret_file_format);
+EphyEmbedSingle *ephy_embed_shell_get_embed_single (EphyEmbedShell *shell);
G_END_DECLS
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 8a8e116f7..29b06bee3 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -58,6 +58,10 @@ ephy_embed_utils_save (GtkWidget *window,
EphyEmbed *embed;
EmbedPersistFlags flags;
gboolean content;
+ EphyEmbedSingle *single;
+
+ single = ephy_embed_shell_get_embed_single
+ (EPHY_EMBED_SHELL (embed_shell));
g_object_ref (G_OBJECT(persist));
@@ -123,12 +127,12 @@ ephy_embed_utils_save (GtkWidget *window,
if (ask_dest)
{
/* show the file picker */
- ret = ephy_embed_shell_show_file_picker
- (embed_shell, window,
- _("Select the destination filename"),
- dirName, fileName, modeSave, &retPath,
- ask_content ? &content : NULL,
- NULL, NULL);
+ ret = ephy_embed_single_show_file_picker
+ (single, window,
+ _("Select the destination filename"),
+ dirName, fileName, modeSave, &retPath,
+ ask_content ? &content : NULL,
+ NULL, NULL);
}
if (ret == G_OK)
@@ -232,11 +236,15 @@ ephy_embed_utils_build_charsets_submenu (BonoboUIComponent *ui_component,
GList *verbs = NULL;
int group_index = 0;
int charset_index = 0;
+ EphyEmbedSingle *single;
+
+ single = ephy_embed_shell_get_embed_single
+ (EPHY_EMBED_SHELL (embed_shell));
START_PROFILER ("Charsets menu")
g_return_if_fail (IS_EPHY_EMBED_SHELL (embed_shell));
- g_return_if_fail (ephy_embed_shell_get_charset_groups (embed_shell, &groups) == G_OK);
+ g_return_if_fail (ephy_embed_single_get_charset_groups (single, &groups) == G_OK);
xml_string = g_string_new (NULL);
g_string_append (xml_string, "<submenu name=\"Encoding\" _label=\"_Encoding\">");
@@ -248,9 +256,9 @@ ephy_embed_utils_build_charsets_submenu (BonoboUIComponent *ui_component,
build_group (xml_string, group, group_index);
- ephy_embed_shell_get_charset_titles (embed_shell,
- group,
- &charsets);
+ ephy_embed_single_get_charset_titles (single,
+ group,
+ &charsets);
for (cl = charsets; cl != NULL; cl = cl->next)
{
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 6c8b98aaa..6c6406d9c 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -22,9 +22,9 @@
#include "ephy-marshal.h"
#include "ephy-embed.h"
+#include "mozilla-embed-single.h"
#include "mozilla-embed.h"
-#include "mozilla-embed-shell.h"
enum
{
@@ -254,9 +254,9 @@ ephy_embed_base_init (gpointer g_class)
}
EphyEmbed *
-ephy_embed_new (GObject *shell)
+ephy_embed_new (GObject *single)
{
- if (IS_MOZILLA_EMBED_SHELL (shell))
+ if (IS_MOZILLA_EMBED_SINGLE (single))
{
return EPHY_EMBED (g_object_new
(MOZILLA_EMBED_TYPE, NULL));
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index d35a03ebf..73671ccbd 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -280,7 +280,7 @@ GType ephy_embed_get_type (void);
/* Base */
-EphyEmbed *ephy_embed_new (GObject *shell);
+EphyEmbed *ephy_embed_new (GObject *single);
void ephy_embed_get_capabilities (EphyEmbed *embed,
EmbedCapabilities *caps);
diff --git a/embed/mozilla/ContentHandler.h b/embed/mozilla/ContentHandler.h
index 6ae61f657..4a6d816d7 100644
--- a/embed/mozilla/ContentHandler.h
+++ b/embed/mozilla/ContentHandler.h
@@ -19,7 +19,7 @@
#ifndef __ContentHandler_h
#define __ContentHandler_h
-#include "mozilla-embed-shell.h"
+#include "ephy-embed-shell.h"
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include "nsIHelperAppLauncherDialog.h"
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index 9d4e312b6..78a01e451 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -525,16 +525,12 @@ nsresult EventContext::GetCSSBackground (nsIDOMNode *node, nsAutoString& url)
nsresult EventContext::GetMouseEventInfo (EphyEmbedEvent *info)
{
nsresult result;
- DOMTimeStamp ts;
nsIDOMMouseEvent *aMouseEvent = (nsIDOMMouseEvent*)mEvent;
aMouseEvent->GetButton ((PRUint16*)&info->mouse_button);
aMouseEvent->GetScreenX ((PRInt32*)&info->mouse_x);
aMouseEvent->GetScreenY ((PRInt32*)&info->mouse_y);
- aMouseEvent->GetTimeStamp(&ts);
- info->timestamp = ts;
-
/* be sure we are not clicking on the scroolbars */
nsCOMPtr<nsIDOMNSEvent> nsEvent = do_QueryInterface(aMouseEvent, &result);
diff --git a/embed/mozilla/GlobalHistory.cpp b/embed/mozilla/GlobalHistory.cpp
index 054b7a5df..8507ad7e9 100644
--- a/embed/mozilla/GlobalHistory.cpp
+++ b/embed/mozilla/GlobalHistory.cpp
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "mozilla-embed-shell.h"
+#include "ephy-embed-shell.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index dd24d6c1e..34db7859e 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -61,6 +61,8 @@ libephymozillaembed_la_SOURCES = \
BaseProtocolContentHandler.h \
ContentHandler.cpp \
ContentHandler.h \
+ EphyEventListener.cpp \
+ EphyEventListener.h \
EphyWrapper.cpp \
EphyWrapper.h \
EventContext.cpp \
@@ -91,14 +93,12 @@ libephymozillaembed_la_SOURCES = \
ProgressListener.h \
StartHereProtocolHandler.cpp \
StartHereProtocolHandler.h \
- EphyEventListener.cpp \
- EphyEventListener.h \
mozilla-embed.cpp \
mozilla-embed.h \
mozilla-embed-persist.cpp \
mozilla-embed-persist.h \
- mozilla-embed-shell.cpp \
- mozilla-embed-shell.h \
+ mozilla-embed-single.cpp \
+ mozilla-embed-single.h \
mozilla-i18n.c \
mozilla-i18n.h \
mozilla-notifiers.cpp \
@@ -107,3 +107,8 @@ libephymozillaembed_la_SOURCES = \
mozilla-prefs.h \
nsUnicharUtils.cpp \
nsUnicharUtils.h
+
+mozilla_DATA = default-prefs.js
+mozilladir = $(pkgdatadir)
+
+EXTRA_DIST = $(mozilla_DATA)
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index 3c5e64be7..a8950fc70 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -34,7 +34,6 @@
#include <nsIFactory.h>
#include <nsIComponentManager.h>
#include <nsCOMPtr.h>
-#include <nsILocalFile.h>
#include <glib.h>
@@ -55,10 +54,6 @@ NS_METHOD RegisterFactory (nsresult (aFactoryFunc)(nsIFactory** aFactory),
const nsCID & aClass, const char *aClassName,
const char *aContractID, PRBool aReplace);
-NS_METHOD RegisterComponent (const nsCID & aClass, const char *aClassName,
- const char *aContractID, const char *aDLLPath,
- PRBool aReplace);
-
//Annoying globals to track the mozilla ftp handler so it can be restored.
static PRBool ftpRegistered = PR_FALSE;
static nsCOMPtr<nsIFactory> nsFtpFactory;
@@ -144,25 +139,6 @@ NS_METHOD RegisterFactory (nsresult (aFactoryFunc)(nsIFactory** aFactory),
return rv;
}
-NS_METHOD RegisterComponent (const nsCID & aClass, const char *aClassName,
- const char *aContractID, const char *aDLLPath,
- PRBool aReplace)
-{
- nsresult rv = NS_OK;
-
- nsCOMPtr<nsILocalFile> dllFile;
- rv = NS_NewLocalFile (NS_ConvertUTF8toUCS2(aDLLPath), PR_TRUE, getter_AddRefs (dllFile));
- if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
-
- rv = nsComponentManager::RegisterComponentSpec (aClass,
- aClassName,
- aContractID,
- dllFile,
- aReplace,
- PR_FALSE);
- return rv;
-}
-
/**
* mozilla_register_FtpProtocolHandler: Register Ftp Protocol Handler
*/
diff --git a/embed/mozilla/PromptService.cpp b/embed/mozilla/PromptService.cpp
index e6181ae32..6674bdd63 100644
--- a/embed/mozilla/PromptService.cpp
+++ b/embed/mozilla/PromptService.cpp
@@ -143,6 +143,7 @@ NS_IMETHODIMP CPromptService::AlertCheck (nsIDOMWindow *parent,
set_title (dialog, dialogTitle);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_dialog_run (GTK_DIALOG (dialog));
get_check_button (check_button, checkValue);
gtk_widget_destroy (dialog);
diff --git a/embed/mozilla/mozilla-embed-shell.h b/embed/mozilla/mozilla-embed-shell.h
deleted file mode 100644
index daedb2948..000000000
--- a/embed/mozilla/mozilla-embed-shell.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef MOZILLA_EMBED_SHELL_H
-#define MOZILLA_EMBED_SHELL_H
-
-#include "glib.h"
-#include "ephy-embed-shell.h"
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define MOZILLA_EMBED_SHELL_TYPE (mozilla_embed_shell_get_type ())
-#define MOZILLA_EMBED_SHELL(obj) (GTK_CHECK_CAST ((obj), MOZILLA_EMBED_SHELL_TYPE, MozillaEmbedShell))
-#define MOZILLA_EMBED_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MOZILLA_EMBED_SHELL_TYPE, MozillaEmbedShellClass))
-#define IS_MOZILLA_EMBED_SHELL(obj) (GTK_CHECK_TYPE ((obj), MOZILLA_EMBED_SHELL_TYPE))
-#define IS_MOZILLA_EMBED_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZILLA_EMBED_SHELL))
-#define MOZILLA_EMBED_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZILLA_EMBED_SHELL_TYPE, MozillaEmbedShellClass))
-
-typedef struct MozillaEmbedShell MozillaEmbedShell;
-typedef struct MozillaEmbedShellPrivate MozillaEmbedShellPrivate;
-
-extern GObject *mozilla_js_console;
-
-struct MozillaEmbedShell
-{
- EphyEmbedShell parent;
- MozillaEmbedShellPrivate *priv;
-};
-
-struct MozillaEmbedShellClass
-{
- EphyEmbedShellClass parent_class;
-};
-
-GType mozilla_embed_shell_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/embed/mozilla/mozilla-embed-shell.cpp b/embed/mozilla/mozilla-embed-single.cpp
index 58c692eb4..fe1fbd1f0 100644
--- a/embed/mozilla/mozilla-embed-shell.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -19,7 +19,7 @@
#include "glib.h"
#include "ephy-string.h"
#include "gtkmozembed.h"
-#include "mozilla-embed-shell.h"
+#include "mozilla-embed-single.h"
#include "mozilla-prefs.h"
#include "ephy-prefs.h"
#include "ephy-file-helpers.h"
@@ -58,53 +58,50 @@
#define MOZILLA_PROFILE_FILE "prefs.js"
static void
-mozilla_embed_shell_class_init (MozillaEmbedShellClass *klass);
+mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass);
static void
-mozilla_embed_shell_init (MozillaEmbedShell *ges);
+mozilla_embed_single_init (MozillaEmbedSingle *ges);
static void
-mozilla_embed_shell_finalize (GObject *object);
+mozilla_embed_single_finalize (GObject *object);
-static void
-impl_get_capabilities (EphyEmbedShell *shell,
- EmbedShellCapabilities *caps);
static gresult
-impl_clear_cache (EphyEmbedShell *shell,
+impl_clear_cache (EphyEmbedSingle *shell,
CacheType type);
static gresult
-impl_set_offline_mode (EphyEmbedShell *shell,
+impl_set_offline_mode (EphyEmbedSingle *shell,
gboolean offline);
static gresult
-impl_load_proxy_autoconf (EphyEmbedShell *shell,
+impl_load_proxy_autoconf (EphyEmbedSingle *shell,
const char* url);
static gresult
-impl_get_charset_titles (EphyEmbedShell *shell,
+impl_get_charset_titles (EphyEmbedSingle *shell,
const char *group,
GList **charsets);
static gresult
-impl_get_charset_groups (EphyEmbedShell *shell,
+impl_get_charset_groups (EphyEmbedSingle *shell,
GList **groups);
static gresult
-impl_get_font_list (EphyEmbedShell *shell,
+impl_get_font_list (EphyEmbedSingle *shell,
const char *langGroup,
const char *fontType,
GList **fontList,
char **default_font);
static gresult
-impl_list_cookies (EphyEmbedShell *shell,
+impl_list_cookies (EphyEmbedSingle *shell,
GList **cookies);
static gresult
-impl_remove_cookies (EphyEmbedShell *shell,
+impl_remove_cookies (EphyEmbedSingle *shell,
GList *cookies);
static gresult
-impl_list_passwords (EphyEmbedShell *shell,
+impl_list_passwords (EphyEmbedSingle *shell,
PasswordType type,
GList **passwords);
static gresult
-impl_remove_passwords (EphyEmbedShell *shell,
+impl_remove_passwords (EphyEmbedSingle *shell,
GList *passwords,
PasswordType type);
static gresult
-impl_show_file_picker (EphyEmbedShell *shell,
+impl_show_file_picker (EphyEmbedSingle *shell,
GtkWidget *parentWidget,
const char *title,
const char *directory,
@@ -115,13 +112,14 @@ impl_show_file_picker (EphyEmbedShell *shell,
FileFormat *file_formats,
int *ret_file_format);
-static void mozilla_embed_shell_new_window_orphan_cb (GtkMozEmbedSingle *embed,
+static void mozilla_embed_single_new_window_orphan_cb (GtkMozEmbedSingle *embed,
GtkMozEmbed **retval,
guint chrome_mask,
- EphyEmbedShell *shell);
+ EphyEmbedSingle *shell);
-struct MozillaEmbedShellPrivate
+struct MozillaEmbedSinglePrivate
{
+ char *user_prefs;
GHashTable *charsets_hash;
GList *sorted_charsets_titles;
};
@@ -131,45 +129,44 @@ static NS_DEFINE_CID(kJVMManagerCID, NS_JVMMANAGER_CID);
static GObjectClass *parent_class = NULL;
GType
-mozilla_embed_shell_get_type (void)
+mozilla_embed_single_get_type (void)
{
- static GType mozilla_embed_shell_type = 0;
+ static GType mozilla_embed_single_type = 0;
- if (mozilla_embed_shell_type == 0)
+ if (mozilla_embed_single_type == 0)
{
static const GTypeInfo our_info =
{
- sizeof (MozillaEmbedShellClass),
+ sizeof (MozillaEmbedSingleClass),
NULL, /* base_init */
NULL, /* base_finalize */
- (GClassInitFunc) mozilla_embed_shell_class_init,
+ (GClassInitFunc) mozilla_embed_single_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
- sizeof (MozillaEmbedShell),
+ sizeof (MozillaEmbedSingle),
0, /* n_preallocs */
- (GInstanceInitFunc) mozilla_embed_shell_init
+ (GInstanceInitFunc) mozilla_embed_single_init
};
- mozilla_embed_shell_type = g_type_register_static (EPHY_EMBED_SHELL_TYPE,
- "MozillaEmbedShell",
+ mozilla_embed_single_type = g_type_register_static (EPHY_EMBED_SINGLE_TYPE,
+ "MozillaEmbedSingle",
&our_info, (GTypeFlags)0);
}
- return mozilla_embed_shell_type;
+ return mozilla_embed_single_type;
}
static void
-mozilla_embed_shell_class_init (MozillaEmbedShellClass *klass)
+mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- EphyEmbedShellClass *shell_class;
+ EphyEmbedSingleClass *shell_class;
parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
- shell_class = EPHY_EMBED_SHELL_CLASS (klass);
+ shell_class = EPHY_EMBED_SINGLE_CLASS (klass);
- object_class->finalize = mozilla_embed_shell_finalize;
+ object_class->finalize = mozilla_embed_single_finalize;
- shell_class->get_capabilities = impl_get_capabilities;
shell_class->clear_cache = impl_clear_cache;
shell_class->set_offline_mode = impl_set_offline_mode;
shell_class->load_proxy_autoconf = impl_load_proxy_autoconf;
@@ -184,7 +181,7 @@ mozilla_embed_shell_class_init (MozillaEmbedShellClass *klass)
}
static void
-mozilla_load_proxy_prefs (MozillaEmbedShell *shell)
+mozilla_load_proxy_prefs (MozillaEmbedSingle *shell)
{
char *tmp;
int i, mozilla_mode = 0;
@@ -244,48 +241,20 @@ mozilla_load_proxy_prefs (MozillaEmbedShell *shell)
/* Autoconfiguration */
tmp = eel_gconf_get_string (CONF_NETWORK_PROXY_AUTO_URL);
g_return_if_fail (tmp != NULL);
- ephy_embed_shell_load_proxy_autoconf
- (EPHY_EMBED_SHELL (shell), tmp);
+ ephy_embed_single_load_proxy_autoconf
+ (EPHY_EMBED_SINGLE (shell), tmp);
g_free (tmp);
}
static void
-mozilla_set_default_prefs (void)
+mozilla_set_default_prefs (MozillaEmbedSingle *mes)
{
- mozilla_prefs_set_boolean ("mozilla.widget.raise-on-setfocus",
- FALSE);
- mozilla_prefs_set_boolean ("browser.display.use_system_colors",
- FALSE);
-
- /* set default search engine */
- mozilla_prefs_set_string ("keyword.URL",_("http://www.google.com/search?q="));
- mozilla_prefs_set_boolean ("keyword.enabled", TRUE);
- mozilla_prefs_set_boolean ("security.checkloaduri", FALSE);
-
- /* while we have no UI */
- mozilla_prefs_set_boolean ("wallet.captureForms", FALSE);
-
- /* deactivate mailcap and mime.types support */
- mozilla_prefs_set_string ("helpers.global_mime_types_file", "");
- mozilla_prefs_set_string ("helpers.global_mailcap_file", "");
- mozilla_prefs_set_string ("helpers.private_mime_types_file", "");
- mozilla_prefs_set_string ("helpers.private_mailcap_file", "");
-
- /* dont allow xpi installs from epiphany, there are crashes */
- mozilla_prefs_set_boolean ("xpinstall.enabled", FALSE);
-
- /* disable sucky XUL ftp view, have nice ns4-like html page instead */
- mozilla_prefs_set_boolean ("network.dir.generate_html", TRUE);
-
- /* set the right accept encoding flags */
- mozilla_prefs_set_string ("network.http.accept-encoding" ,
- "gzip, deflate, compress;q=0.9");
-
- mozilla_prefs_save ();
+ mozilla_prefs_load (ephy_file ("default-prefs.js"));
+ mozilla_prefs_save (mes->priv->user_prefs);
}
static void
-mozilla_init_single (MozillaEmbedShell *mes)
+mozilla_init_single (MozillaEmbedSingle *mes)
{
GtkMozEmbedSingle *single;
@@ -298,7 +267,7 @@ mozilla_init_single (MozillaEmbedShell *mes)
/* allow creation of orphan windows */
g_signal_connect (G_OBJECT (single), "new_window_orphan",
- GTK_SIGNAL_FUNC (mozilla_embed_shell_new_window_orphan_cb),
+ GTK_SIGNAL_FUNC (mozilla_embed_single_new_window_orphan_cb),
mes);
}
@@ -323,20 +292,21 @@ mozilla_init_profile (void)
}
static gboolean
-is_new_build (void)
+is_new_build (MozillaEmbedSingle *mes)
{
gboolean new_build = FALSE;
- char *mozprefs, *build_test;
+ char *build_test;
+ char *prefs_file;
- mozprefs = g_build_filename (ephy_dot_dir (),
- MOZILLA_PROFILE_DIR,
- MOZILLA_PROFILE_NAME,
- MOZILLA_PROFILE_FILE,
- NULL);
+ prefs_file = g_build_filename (ephy_dot_dir (),
+ MOZILLA_PROFILE_DIR,
+ MOZILLA_PROFILE_NAME,
+ MOZILLA_PROFILE_FILE,
+ NULL);
/* no mozilla prefs ? or new epiphany build */
build_test = eel_gconf_get_string ("/apps/epiphany/gconf_test");
- if (!g_file_test(mozprefs, G_FILE_TEST_EXISTS) ||
+ if (!g_file_test(mes->priv->user_prefs, G_FILE_TEST_EXISTS) ||
build_test == NULL ||
strncmp (build_test, __TIME__, 8) != 0)
{
@@ -344,16 +314,15 @@ is_new_build (void)
eel_gconf_set_string ("/apps/epiphany/gconf_test", __TIME__);
}
- g_free (mozprefs);
g_free (build_test);
return new_build;
}
static void
-mozilla_init_prefs (void)
+mozilla_init_prefs (MozillaEmbedSingle *mes)
{
- mozilla_set_default_prefs ();
+ mozilla_set_default_prefs (mes);
mozilla_notifiers_set_defaults ();
}
@@ -398,19 +367,25 @@ mozilla_register_external_protocols (void)
}
static void
-mozilla_embed_shell_init (MozillaEmbedShell *mes)
+mozilla_embed_single_init (MozillaEmbedSingle *mes)
{
gboolean new_build;
-
- mes->priv = g_new0 (MozillaEmbedShellPrivate, 1);
-
+
+ mes->priv = g_new0 (MozillaEmbedSinglePrivate, 1);
mes->priv->charsets_hash = NULL;
mes->priv->sorted_charsets_titles = NULL;
- new_build = is_new_build ();
+ mes->priv->user_prefs =
+ g_build_filename (ephy_dot_dir (),
+ MOZILLA_PROFILE_DIR,
+ MOZILLA_PROFILE_NAME,
+ MOZILLA_PROFILE_FILE,
+ NULL);
+
+ new_build = is_new_build (mes);
/* Pre initialization */
- mozilla_notifiers_init (mes);
+ mozilla_notifiers_init (EPHY_EMBED_SINGLE (mes));
mozilla_init_home ();
mozilla_init_profile ();
@@ -420,7 +395,7 @@ mozilla_embed_shell_init (MozillaEmbedShell *mes)
/* Post initialization */
if (new_build)
{
- mozilla_init_prefs ();
+ mozilla_init_prefs (mes);
}
mozilla_load_proxy_prefs (mes);
@@ -435,10 +410,10 @@ mozilla_embed_shell_init (MozillaEmbedShell *mes)
}
static void
-mozilla_embed_shell_new_window_orphan_cb (GtkMozEmbedSingle *embed,
+mozilla_embed_single_new_window_orphan_cb (GtkMozEmbedSingle *embed,
GtkMozEmbed **retval,
guint chrome_mask,
- EphyEmbedShell *shell)
+ EphyEmbedSingle *shell)
{
/* FIXME conversion duped in mozilla_embed */
EphyEmbed *new_embed;
@@ -480,51 +455,34 @@ mozilla_embed_shell_new_window_orphan_cb (GtkMozEmbedSingle *embed,
}
static void
-mozilla_embed_shell_finalize (GObject *object)
+mozilla_embed_single_finalize (GObject *object)
{
- MozillaEmbedShell *mes;
+ MozillaEmbedSingle *mes;
- /* Destroy EphyEmbedShell before because some
+ /* Destroy EphyEmbedSingle before because some
* services depend on xpcom */
G_OBJECT_CLASS (parent_class)->finalize (object);
g_return_if_fail (object != NULL);
- g_return_if_fail (IS_MOZILLA_EMBED_SHELL (object));
+ g_return_if_fail (IS_MOZILLA_EMBED_SINGLE (object));
- mes = MOZILLA_EMBED_SHELL (object);
+ mes = MOZILLA_EMBED_SINGLE (object);
g_return_if_fail (mes->priv != NULL);
mozilla_notifiers_free ();
- mozilla_prefs_save ();
+ mozilla_prefs_save (mes->priv->user_prefs);
gtk_moz_embed_pop_startup ();
-
- g_free (mes->priv);
-}
-static void
-impl_get_capabilities (EphyEmbedShell *shell,
- EmbedShellCapabilities *caps)
-{
- EmbedShellCapabilities mycaps;
-
- mycaps = (EmbedShellCapabilities)
- (CACHE_CLEAR_CAP |
- OFFLINE_CAP |
- PROXY_AUTOCONF_CAP |
- JAVA_CONSOLE_CAP |
- JS_CONSOLE_CAP |
- CHARSETS_CAP |
- COOKIES_CAP |
- PASSWORDS_CAP);
+ g_free (mes->priv->user_prefs);
- *caps = mycaps;
+ g_free (mes->priv);
}
static gresult
-impl_clear_cache (EphyEmbedShell *shell,
+impl_clear_cache (EphyEmbedSingle *shell,
CacheType type)
{
nsresult rv;
@@ -539,7 +497,7 @@ impl_clear_cache (EphyEmbedShell *shell,
}
static gresult
-impl_set_offline_mode (EphyEmbedShell *shell,
+impl_set_offline_mode (EphyEmbedSingle *shell,
gboolean offline)
{
nsresult rv;
@@ -555,7 +513,7 @@ impl_set_offline_mode (EphyEmbedShell *shell,
}
static gresult
-impl_load_proxy_autoconf (EphyEmbedShell *shell,
+impl_load_proxy_autoconf (EphyEmbedSingle *shell,
const char* url)
{
nsresult rv;
@@ -572,7 +530,7 @@ impl_load_proxy_autoconf (EphyEmbedShell *shell,
}
static gresult
-fill_charsets_lists (MozillaEmbedShellPrivate *priv)
+fill_charsets_lists (MozillaEmbedSinglePrivate *priv)
{
nsresult rv;
char *tmp;
@@ -650,7 +608,7 @@ fill_charsets_lists (MozillaEmbedShellPrivate *priv)
}
static void
-ensure_charsets_tables (MozillaEmbedShell *shell)
+ensure_charsets_tables (MozillaEmbedSingle *shell)
{
if (!shell->priv->charsets_hash)
{
@@ -659,15 +617,15 @@ ensure_charsets_tables (MozillaEmbedShell *shell)
}
static gresult
-impl_get_charset_titles (EphyEmbedShell *shell,
+impl_get_charset_titles (EphyEmbedSingle *shell,
const char *group,
GList **charsets)
{
- MozillaEmbedShell *mshell = MOZILLA_EMBED_SHELL(shell);
+ MozillaEmbedSingle *mshell = MOZILLA_EMBED_SINGLE(shell);
int count = get_translated_cscount ();
GList *l = NULL;
int j;
-
+
ensure_charsets_tables (mshell);
g_return_val_if_fail (mshell->priv->charsets_hash != NULL, G_FAILED);
@@ -693,7 +651,7 @@ impl_get_charset_titles (EphyEmbedShell *shell,
}
static gresult
-impl_get_charset_groups (EphyEmbedShell *shell,
+impl_get_charset_groups (EphyEmbedSingle *shell,
GList **groups)
{
GList *l = NULL;
@@ -710,7 +668,7 @@ impl_get_charset_groups (EphyEmbedShell *shell,
}
static gresult
-impl_get_font_list (EphyEmbedShell *shell,
+impl_get_font_list (EphyEmbedSingle *shell,
const char *langGroup,
const char *fontType,
GList **fontList,
@@ -760,7 +718,7 @@ impl_get_font_list (EphyEmbedShell *shell,
}
static gresult
-impl_list_cookies (EphyEmbedShell *shell,
+impl_list_cookies (EphyEmbedSingle *shell,
GList **cookies)
{
nsresult result;
@@ -819,7 +777,7 @@ impl_list_cookies (EphyEmbedShell *shell,
}
static gresult
-impl_remove_cookies (EphyEmbedShell *shell,
+impl_remove_cookies (EphyEmbedSingle *shell,
GList *cookies)
{
nsresult result;
@@ -843,7 +801,7 @@ impl_remove_cookies (EphyEmbedShell *shell,
}
static gresult
-impl_list_passwords (EphyEmbedShell *shell,
+impl_list_passwords (EphyEmbedSingle *shell,
PasswordType type,
GList **passwords)
{
@@ -892,7 +850,7 @@ impl_list_passwords (EphyEmbedShell *shell,
}
static gresult
-impl_remove_passwords (EphyEmbedShell *shell,
+impl_remove_passwords (EphyEmbedSingle *shell,
GList *passwords,
PasswordType type)
{
@@ -922,7 +880,7 @@ impl_remove_passwords (EphyEmbedShell *shell,
}
static gresult
-impl_show_file_picker (EphyEmbedShell *shell,
+impl_show_file_picker (EphyEmbedSingle *shell,
GtkWidget *parentWidget,
const char *title,
const char *directory,
diff --git a/embed/mozilla/mozilla-embed-single.h b/embed/mozilla/mozilla-embed-single.h
new file mode 100644
index 000000000..f46760d0c
--- /dev/null
+++ b/embed/mozilla/mozilla-embed-single.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MOZILLA_EMBED_SINGLE_H
+#define MOZILLA_EMBED_SINGLE_H
+
+#include "glib.h"
+#include "ephy-embed-shell.h"
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MOZILLA_EMBED_SINGLE_TYPE (mozilla_embed_single_get_type ())
+#define MOZILLA_EMBED_SINGLE(obj) (GTK_CHECK_CAST ((obj), MOZILLA_EMBED_SINGLE_TYPE, MozillaEmbedSingle))
+#define MOZILLA_EMBED_SINGLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MOZILLA_EMBED_SINGLE_TYPE, MozillaEmbedSingleClass))
+#define IS_MOZILLA_EMBED_SINGLE(obj) (GTK_CHECK_TYPE ((obj), MOZILLA_EMBED_SINGLE_TYPE))
+#define IS_MOZILLA_EMBED_SINGLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MOZILLA_EMBED_SINGLE))
+#define MOZILLA_EMBED_SINGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOZILLA_EMBED_SINGLE_TYPE, MozillaEmbedSingleClass))
+
+typedef struct MozillaEmbedSingle MozillaEmbedSingle;
+typedef struct MozillaEmbedSinglePrivate MozillaEmbedSinglePrivate;
+
+struct MozillaEmbedSingle
+{
+ EphyEmbedSingle parent;
+ MozillaEmbedSinglePrivate *priv;
+};
+
+struct MozillaEmbedSingleClass
+{
+ EphyEmbedSingleClass parent_class;
+};
+
+GType mozilla_embed_single_get_type (void);
+
+G_END_DECLS
+
+#endif
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
index 24dfbb7a5..e188ecb99 100644
--- a/embed/mozilla/mozilla-notifiers.cpp
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -19,6 +19,7 @@
#include "config.h"
#include "ephy-embed-shell.h"
+#include "ephy-embed-single.h"
#include "mozilla-notifiers.h"
#include "eel-gconf-extensions.h"
#include "mozilla-prefs.h"
@@ -82,7 +83,7 @@ static void
mozilla_autodetect_charset_notifier(GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
- EphyEmbedShell *shell);
+ EphyEmbedSingle *single);
static void
mozilla_default_font_notifier(GConfClient *client,
@@ -111,7 +112,7 @@ static void
mozilla_default_charset_notifier (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
- EphyEmbedShell *shell);
+ EphyEmbedSingle *single);
static void
mozilla_socks_version_notifier (GConfClient *client,
guint cnxn_id,
@@ -256,12 +257,14 @@ mozilla_proxy_autoconfig_notifier (GConfClient *client,
GConfEntry *entry,
char *pref)
{
- ephy_embed_shell_load_proxy_autoconf
- (embed_shell, gconf_value_get_string(entry->value));
+ EphyEmbedSingle *single;
+ single = ephy_embed_shell_get_embed_single (embed_shell);
+ ephy_embed_single_load_proxy_autoconf
+ (single, gconf_value_get_string(entry->value));
}
void
-mozilla_notifiers_init(MozillaEmbedShell *shell)
+mozilla_notifiers_init(EphyEmbedSingle *single)
{
int i;
@@ -296,7 +299,7 @@ mozilla_notifiers_init(MozillaEmbedShell *shell)
ephy_notification_add(
custom_notifiers[i].gconf_key,
custom_notifiers[i].func,
- (gpointer)shell,
+ (gpointer)single,
&mozilla_notifiers);
}
@@ -482,7 +485,7 @@ static void
mozilla_default_charset_notifier(GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
- EphyEmbedShell *shell)
+ EphyEmbedSingle *single)
{
/* FIXME */
}
@@ -594,7 +597,7 @@ static void
mozilla_autodetect_charset_notifier(GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
- EphyEmbedShell *shell)
+ EphyEmbedSingle *single)
{
int charset = eel_gconf_get_integer (CONF_LANGUAGE_AUTODETECT_CHARSET);
if (charset < 0 ||
diff --git a/embed/mozilla/mozilla-notifiers.h b/embed/mozilla/mozilla-notifiers.h
index 6718365f7..f7882b83f 100644
--- a/embed/mozilla/mozilla-notifiers.h
+++ b/embed/mozilla/mozilla-notifiers.h
@@ -19,9 +19,9 @@
#ifndef MOZILLA_NOTIFIERS_H
#define MOZILLA_NOTIFIERS_H
-#include "mozilla-embed-shell.h"
+#include "ephy-embed-single.h"
-void mozilla_notifiers_init (MozillaEmbedShell *shell);
+void mozilla_notifiers_init (EphyEmbedSingle *single);
void mozilla_notifiers_set_defaults (void);
diff --git a/embed/mozilla/mozilla-prefs.cpp b/embed/mozilla/mozilla-prefs.cpp
index e5b8c68e2..55f9dcc6b 100644
--- a/embed/mozilla/mozilla-prefs.cpp
+++ b/embed/mozilla/mozilla-prefs.cpp
@@ -22,17 +22,50 @@
#include <nsIPrefService.h>
#include <nsIServiceManager.h>
#include <nsMemory.h>
+#include <nsILocalFile.h>
+#include <nsString.h>
#include <glib/gmessages.h>
#include <glib/gstrfuncs.h>
+void
+mozilla_prefs_load (const char *filename)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsILocalFile> prefsLocalFile;
+ rv = NS_NewLocalFile (NS_ConvertUTF8toUCS2(filename), PR_TRUE, getter_AddRefs (prefsLocalFile));
+ g_return_if_fail (NS_SUCCEEDED(rv));
+
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ g_return_if_fail (prefService != nsnull);
+
+ nsCOMPtr<nsIFile> prefsFile;
+ prefsLocalFile->QueryInterface(NS_GET_IID(nsIFile), (void **)&prefsFile);
+ g_return_if_fail (prefsFile != nsnull);
+
+ prefService->ReadUserPrefs (prefsFile);
+}
+
gboolean
-mozilla_prefs_save (void)
+mozilla_prefs_save (const char *filename)
{
+ nsresult rv;
+
+ nsCOMPtr<nsILocalFile> prefsLocalFile;
+ rv = NS_NewLocalFile (NS_ConvertUTF8toUCS2(filename), PR_TRUE, getter_AddRefs (prefsLocalFile));
+ g_return_val_if_fail (NS_SUCCEEDED(rv), FALSE);
+
nsCOMPtr<nsIPrefService> prefService =
do_GetService (NS_PREFSERVICE_CONTRACTID);
g_return_val_if_fail (prefService != nsnull, FALSE);
- nsresult rv = prefService->SavePrefFile (nsnull);
+ nsCOMPtr<nsIFile> prefsFile;
+ prefsLocalFile->QueryInterface(NS_GET_IID(nsIFile), (void **)&prefsFile);
+ g_return_val_if_fail (prefsFile != nsnull, FALSE);
+
+ rv = prefService->SavePrefFile (prefsFile);
+
return NS_SUCCEEDED (rv) ? TRUE : FALSE;
}
@@ -165,21 +198,3 @@ mozilla_prefs_get_string(const char *preference_name)
return result;
}
-gboolean
-mozilla_prefs_remove (const char *preference_name)
-{
- g_return_val_if_fail (preference_name != NULL, FALSE);
-
- nsCOMPtr<nsIPrefService> prefService =
- do_GetService (NS_PREFSERVICE_CONTRACTID);
- nsCOMPtr<nsIPrefBranch> pref;
- prefService->GetBranch ("", getter_AddRefs(pref));
-
- if (pref)
- {
- nsresult rv = pref->ClearUserPref (preference_name);
- return NS_SUCCEEDED (rv) ? TRUE : FALSE;
- }
-
- return FALSE;
-}
diff --git a/embed/mozilla/mozilla-prefs.h b/embed/mozilla/mozilla-prefs.h
index 82055c4a7..91d98c2e0 100644
--- a/embed/mozilla/mozilla-prefs.h
+++ b/embed/mozilla/mozilla-prefs.h
@@ -21,15 +21,17 @@
#include "glib/gtypes.h"
-gboolean mozilla_prefs_save (void);
+void mozilla_prefs_load (const char *filename);
-gboolean mozilla_prefs_set_string (const char *preference_name,
+gboolean mozilla_prefs_save (const char *filename);
+
+gboolean mozilla_prefs_set_string (const char *preference_name,
const char *new_value);
gboolean mozilla_prefs_set_boolean (const char *preference_name,
gboolean new_boolean_value);
-gboolean mozilla_prefs_set_int (const char *preference_name,
+gboolean mozilla_prefs_set_int (const char *preference_name,
int new_int_value);
gboolean mozilla_prefs_get_boolean (const char *preference_name,
@@ -39,6 +41,4 @@ int mozilla_prefs_get_int (const char *preference_name);
gchar *mozilla_prefs_get_string (const char *preference_name);
-gboolean mozilla_prefs_remove (const char *preference_name);
-
#endif