aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--embed/downloader-view.c2
-rw-r--r--embed/mozilla/Makefile.am7
-rw-r--r--embed/mozilla/default-prefs.js27
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp60
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp62
-rw-r--r--embed/mozilla/mozilla-prefs.cpp200
-rw-r--r--embed/mozilla/mozilla-prefs.h44
-rw-r--r--lib/ephy-dnd.c2
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c2
-rw-r--r--src/ephy-history-window.c2
11 files changed, 137 insertions, 290 deletions
diff --git a/ChangeLog b/ChangeLog
index 2be922cb8..9fe725672 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2003-05-20 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * embed/downloader-view.c: (downloader_view_build_ui):
+ * embed/mozilla/Makefile.am:
+ * embed/mozilla/default-prefs.js:
+ * embed/mozilla/mozilla-embed-single.cpp:
+ * embed/mozilla/mozilla-notifiers.cpp:
+ * embed/mozilla/mozilla-prefs.cpp:
+ * embed/mozilla/mozilla-prefs.h:
+ * lib/ephy-dnd.c: (ephy_dnd_node_list_extract_nodes):
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (ephy_bookmarks_editor_construct):
+ * src/ephy-history-window.c: (ephy_history_window_construct):
+
+ Fix some warnings.
+ Go back hardcoding defaults in the code, mozilla pref api sucks :/
+ Cleanup mozilla prefs code, we can use mozilla api directly now,
+ no need for a wrapper like in galeon1.
+
2003-05-19 Christian Neumair <chris@gnome-de.org>
* data/glade/epiphany.glade
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index bcc948276..46e4dabb4 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -802,7 +802,7 @@ downloader_view_build_ui (DownloaderView *dv)
priv->model = GTK_TREE_MODEL (liststore);
- icon = gtk_widget_render_icon (GTK_WINDOW (priv->window),
+ icon = gtk_widget_render_icon (GTK_WIDGET (priv->window),
EPHY_STOCK_DOWNLOAD,
GTK_ICON_SIZE_MENU,
NULL);
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index 1db481fba..a2cc20c5f 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -99,12 +99,5 @@ libephymozillaembed_la_SOURCES = \
mozilla-i18n.h \
mozilla-notifiers.cpp \
mozilla-notifiers.h \
- mozilla-prefs.cpp \
- mozilla-prefs.h \
nsUnicharUtils.cpp \
nsUnicharUtils.h
-
-mozilla_DATA = default-prefs.js
-mozilladir = $(pkgdatadir)
-
-EXTRA_DIST = $(mozilla_DATA)
diff --git a/embed/mozilla/default-prefs.js b/embed/mozilla/default-prefs.js
deleted file mode 100644
index be5a185c5..000000000
--- a/embed/mozilla/default-prefs.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// Don't allow mozilla to raise window when setting focus (work around bugs)
-user_pref("mozilla.widget.raise-on-setfocus", false);
-
-// set default search engine
-user_pref("keyword.URL", "http://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=");
-user_pref("keyword.enabled", true);
-user_pref("security.checkloaduri", false);
-
-// dont allow xpi installs from epiphany, there are crashes
-user_pref("xpinstall.enabled", false);
-
-// deactivate mailcap and mime.types support
-user_pref("helpers.global_mailcap_file", "");
-user_pref("helpers.global_mime_types_file", "");
-user_pref("helpers.private_mailcap_file", "");
-user_pref("helpers.private_mime_types_file", "");
-
-// disable sucky XUL ftp view, have nice ns4-like html page instead
-user_pref("network.dir.generate_html", true);
-
-// disable usless security warnings
-user_pref("security.warn_entering_secure", false);
-user_pref("security.warn_leaving_secure", false);
-user_pref("security.warn_submit_insecure", false);
-
-// Always use the system colors if a page doesn't specify its own.
-user_pref("browser.display.use_system_colors", true);
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index aa7daee03..612e2e546 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -21,7 +21,6 @@
#include "ephy-debug.h"
#include "gtkmozembed.h"
#include "mozilla-embed-single.h"
-#include "mozilla-prefs.h"
#include "ephy-prefs.h"
#include "ephy-file-helpers.h"
#include "mozilla-notifiers.h"
@@ -36,6 +35,7 @@
#include <string.h>
#include <nsICacheService.h>
#include <nsCOMPtr.h>
+#include <nsIPrefService.h>
#include <nsNetCID.h>
#include <nsIServiceManager.h>
#include <nsIIOService.h>
@@ -183,8 +183,45 @@ mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass)
static void
mozilla_set_default_prefs (MozillaEmbedSingle *mes)
{
- mozilla_prefs_load (ephy_file ("default-prefs.js"));
- mozilla_prefs_save (mes->priv->user_prefs);
+ nsCOMPtr<nsIPrefService> prefService;
+
+ prefService = do_GetService (NS_PREFSERVICE_CONTRACTID);
+ g_return_if_fail (prefService != NULL);
+
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+ g_return_if_fail (pref != NULL);
+
+ /* Don't allow mozilla to raise window when setting focus (work around bugs) */
+ pref->SetBoolPref ("mozilla.widget.raise-on-setfocus", PR_FALSE);
+
+ /* set default search engine */
+ pref->SetCharPref ("keyword.URL", "http://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=");
+ pref->SetBoolPref ("keyword.enabled", PR_TRUE);
+ pref->SetBoolPref ("security.checkloaduri", PR_FALSE);
+
+ /* dont allow xpi installs from epiphany, there are crashes */
+ pref->SetBoolPref ("xpinstall.enabled", PR_FALSE);
+
+ /* deactivate mailcap and mime.types support */
+ pref->SetCharPref ("helpers.global_mailcap_file", "");
+ pref->SetCharPref ("helpers.global_mime_types_file", "");
+ pref->SetCharPref ("helpers.private_mailcap_file", "");
+ pref->SetCharPref ("helpers.private_mime_types_file", "");
+
+ /* disable sucky XUL ftp view, have nice ns4-like html page instead */
+ pref->SetBoolPref ("network.dir.generate_html", PR_TRUE);
+
+ /* disable usless security warnings */
+ pref->SetBoolPref ("security.warn_entering_secure", PR_FALSE);
+ pref->SetBoolPref ("security.warn_leaving_secure", PR_FALSE);
+ pref->SetBoolPref ("security.warn_submit_insecure", PR_FALSE);
+
+ /* Always use the system colors if a page doesn't specify its own. */
+ pref->SetBoolPref ("browser.display.use_system_colors", PR_TRUE);
+
+ /* Smooth scrolling on */
+ pref->SetBoolPref ("general.smoothScroll", PR_TRUE);
}
static void
@@ -364,8 +401,6 @@ mozilla_embed_single_finalize (GObject *object)
mozilla_notifiers_free ();
- mozilla_prefs_save (mes->priv->user_prefs);
-
gtk_moz_embed_pop_startup ();
g_free (mes->priv->user_prefs);
@@ -599,11 +634,22 @@ impl_get_font_list (EphyEmbedSingle *shell,
if (default_font != NULL)
{
- char key [255];
+ char key[255];
+ char *value = NULL;
+ nsCOMPtr<nsIPrefService> prefService;
+
+ prefService = do_GetService (NS_PREFSERVICE_CONTRACTID);
+ g_return_val_if_fail (prefService != NULL, G_FAILED);
+
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+ g_return_val_if_fail (pref != NULL, G_FAILED);
sprintf (key, "font.name.%s.%s", fontType, langGroup);
- *default_font = mozilla_prefs_get_string (key);
+ pref->GetCharPref (key, &value);
+ *default_font = g_strdup (value);
+ nsMemory::Free (value);
}
return G_OK;
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
index 0ef4b18d0..1dd53a385 100644
--- a/embed/mozilla/mozilla-notifiers.cpp
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -24,7 +24,6 @@
#include "ephy-embed-single.h"
#include "mozilla-notifiers.h"
#include "eel-gconf-extensions.h"
-#include "mozilla-prefs.h"
#include "MozRegisterComponents.h"
#include "ephy-prefs.h"
#include "ephy-embed-prefs.h"
@@ -37,6 +36,9 @@
#include <stdlib.h>
#include <sys/utsname.h>
#include "nsBuildID.h"
+#include "nsCOMPtr.h"
+#include "nsIPrefService.h"
+#include "nsIServiceManager.h"
static void
mozilla_own_colors_notifier(GConfClient *client,
@@ -188,6 +190,64 @@ custom_notifiers [] =
{NULL, NULL}
};
+static gboolean
+mozilla_prefs_set_string(const char *preference_name, const char *new_value)
+{
+ g_return_val_if_fail (preference_name != NULL, FALSE);
+ g_return_val_if_fail (new_value != NULL, FALSE);
+ nsCOMPtr<nsIPrefService> prefService =
+ do_GetService (NS_PREFSERVICE_CONTRACTID);
+ nsCOMPtr<nsIPrefBranch> pref;
+ prefService->GetBranch ("", getter_AddRefs(pref));
+
+ if (pref)
+ {
+ nsresult rv = pref->SetCharPref (preference_name, new_value);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+mozilla_prefs_set_boolean (const char *preference_name,
+ gboolean new_boolean_value)
+{
+ 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->SetBoolPref (preference_name,
+ new_boolean_value ? PR_TRUE : PR_FALSE);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+ }
+ return FALSE;
+}
+
+static gboolean
+mozilla_prefs_set_int (const char *preference_name, int new_int_value)
+{
+ 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->SetIntPref (preference_name, new_int_value);
+ return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+ }
+
+ return FALSE;
+}
+
static void
mozilla_font_size_notifier (GConfClient *client,
guint cnxn_id,
diff --git a/embed/mozilla/mozilla-prefs.cpp b/embed/mozilla/mozilla-prefs.cpp
deleted file mode 100644
index 55f9dcc6b..000000000
--- a/embed/mozilla/mozilla-prefs.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2000-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.
- */
-
-#include "mozilla-prefs.h"
-
-#include <nsCOMPtr.h>
-#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 (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);
-
- 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;
-}
-
-gboolean
-mozilla_prefs_set_string(const char *preference_name, const char *new_value)
-{
- g_return_val_if_fail (preference_name != NULL, FALSE);
- g_return_val_if_fail (new_value != NULL, FALSE);
- nsCOMPtr<nsIPrefService> prefService =
- do_GetService (NS_PREFSERVICE_CONTRACTID);
- nsCOMPtr<nsIPrefBranch> pref;
- prefService->GetBranch ("", getter_AddRefs(pref));
-
- if (pref)
- {
- nsresult rv = pref->SetCharPref (preference_name, new_value);
- return NS_SUCCEEDED (rv) ? TRUE : FALSE;
- }
-
- return FALSE;
-}
-
-gboolean
-mozilla_prefs_set_boolean (const char *preference_name,
- gboolean new_boolean_value)
-{
- 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->SetBoolPref (preference_name,
- new_boolean_value ? PR_TRUE : PR_FALSE);
- return NS_SUCCEEDED (rv) ? TRUE : FALSE;
- }
- return FALSE;
-}
-
-gboolean
-mozilla_prefs_set_int (const char *preference_name, int new_int_value)
-{
- 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->SetIntPref (preference_name, new_int_value);
- return NS_SUCCEEDED (rv) ? TRUE : FALSE;
- }
-
- return FALSE;
-}
-
-gboolean
-mozilla_prefs_get_boolean (const char *preference_name,
- gboolean default_value)
-{
- PRBool value;
-
- 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 result;
-
- result = pref->GetBoolPref (preference_name, &value);
- if (NS_FAILED (result)) return default_value;
- }
-
- return (value == PR_TRUE) ? TRUE : FALSE;
-}
-
-gint
-mozilla_prefs_get_int (const char *preference_name)
-{
- int value = -1;
-
- 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)
- {
- pref->GetIntPref (preference_name, &value);
- }
-
- return value;
-}
-
-gchar *
-mozilla_prefs_get_string(const char *preference_name)
-{
- gchar *value = NULL;
- gchar *result = NULL;
-
- 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)
- {
- pref->GetCharPref (preference_name, &value);
- }
-
- /* it's allocated by mozilla, so I could not g_free it */
- if (value)
- {
- result = g_strdup (value);
- nsMemory::Free (value);
- }
-
- return result;
-}
-
diff --git a/embed/mozilla/mozilla-prefs.h b/embed/mozilla/mozilla-prefs.h
deleted file mode 100644
index 91d98c2e0..000000000
--- a/embed/mozilla/mozilla-prefs.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2000-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_PREFS_H
-#define MOZILLA_PREFS_H
-
-#include "glib/gtypes.h"
-
-void mozilla_prefs_load (const char *filename);
-
-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,
- int new_int_value);
-
-gboolean mozilla_prefs_get_boolean (const char *preference_name,
- gboolean default_value);
-
-int mozilla_prefs_get_int (const char *preference_name);
-
-gchar *mozilla_prefs_get_string (const char *preference_name);
-
-#endif
diff --git a/lib/ephy-dnd.c b/lib/ephy-dnd.c
index def09d14f..8c18bd754 100644
--- a/lib/ephy-dnd.c
+++ b/lib/ephy-dnd.c
@@ -117,7 +117,7 @@ ephy_dnd_node_list_extract_nodes (const char *node_list)
nodes = g_strsplit (node_list, ";", -1);
- db = ephy_node_db_get_by_name (nodes[i]);
+ db = ephy_node_db_get_by_name (nodes[0]);
g_return_val_if_fail (db != NULL, NULL);
for (i = 1; nodes[i] != NULL; i++)
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index a716fd9fa..4a09e768e 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1119,7 +1119,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_window_set_title (GTK_WINDOW (editor), _("Bookmarks"));
- icon = gtk_widget_render_icon (GTK_WINDOW (editor),
+ icon = gtk_widget_render_icon (GTK_WIDGET (editor),
EPHY_STOCK_BOOKMARKS,
GTK_ICON_SIZE_MENU,
NULL);
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 9199a034a..e1605335c 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -951,7 +951,7 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
gtk_window_set_title (GTK_WINDOW (editor), _("History"));
- icon = gtk_widget_render_icon (GTK_WINDOW (editor),
+ icon = gtk_widget_render_icon (GTK_WIDGET (editor),
EPHY_STOCK_HISTORY,
GTK_ICON_SIZE_MENU,
NULL);