mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-19 15:51:40 +00:00
Fix bug 4112 - Mozilla component does not listen for proxy configuration
* components/mozilla/mozilla-preferences.cpp: * components/mozilla/mozilla-preferences.h: * components/mozilla/nautilus-mozilla-content-view.c: (nautilus_mozilla_content_view_initialize), (nautilus_mozilla_content_view_destroy), (eazel_services_scheme_translate), (test_make_full_uri_from_relative), (mozilla_content_view_one_time_happenings): Fix bug 4112 - Mozilla component does not listen for proxy configuration changes. Move all the gconf and proxy related things to mozilla-preferences.cpp, makes the main view implementation a little less convoluted. Add gconf notifications for changes in the proxy and route these changes to the mozilla universe. Also some minor style changes.
This commit is contained in:
parent
6194a4b060
commit
aa07660299
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2000-10-30 Ramiro Estrugo <ramiro@eazel.com>
|
||||
|
||||
* components/mozilla/mozilla-preferences.cpp:
|
||||
* components/mozilla/mozilla-preferences.h:
|
||||
* components/mozilla/nautilus-mozilla-content-view.c:
|
||||
(nautilus_mozilla_content_view_initialize),
|
||||
(nautilus_mozilla_content_view_destroy),
|
||||
(eazel_services_scheme_translate),
|
||||
(test_make_full_uri_from_relative),
|
||||
(mozilla_content_view_one_time_happenings):
|
||||
Fix bug 4112 - Mozilla component does not listen for proxy
|
||||
configuration changes.
|
||||
|
||||
Move all the gconf and proxy related things to
|
||||
mozilla-preferences.cpp, makes the main view implementation a
|
||||
little less convoluted.
|
||||
|
||||
Add gconf notifications for changes in the proxy and route these
|
||||
changes to the mozilla universe.
|
||||
|
||||
Also some minor style changes.
|
||||
|
||||
2000-10-30 Darin Adler <darin@eazel.com>
|
||||
|
||||
Fix bug 4202 (rename a file to an existing file will crash
|
||||
|
|
|
@ -29,23 +29,35 @@
|
|||
|
||||
#include "mozilla-preferences.h"
|
||||
|
||||
#include <libgnome/gnome-defs.h>
|
||||
#include <gtk/gtkobject.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include <libgnomeui/gnome-dialog.h>
|
||||
#include <libgnomeui/gnome-dialog-util.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#if (MOZILLA_MILESTONE >= 18)
|
||||
#define PREF_ID NS_PREF_CONTRACTID
|
||||
#else
|
||||
#define PREF_ID NS_PREF_PROGID
|
||||
#endif
|
||||
static GConfClient *preferences_get_global_gconf_client (void);
|
||||
static void preferences_proxy_sync_mozilla_with_gconf (void);
|
||||
|
||||
static const char PROXY_KEY[] = "/system/gnome-vfs/http-proxy";
|
||||
static const char USE_PROXY_KEY[] = "/system/gnome-vfs/use-http-proxy";
|
||||
static const char SYSTEM_GNOME_VFS_PATH[] = "/system/gnome-vfs";
|
||||
|
||||
extern "C" gboolean
|
||||
mozilla_preference_set (const char *preference_name,
|
||||
const char *new_value)
|
||||
mozilla_preference_set (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<nsIPref> pref = do_CreateInstance(PREF_ID);
|
||||
nsCOMPtr<nsIPref> pref = do_CreateInstance (NS_PREF_CONTRACTID);
|
||||
|
||||
if (pref)
|
||||
{
|
||||
|
@ -58,18 +70,18 @@ mozilla_preference_set (const char *preference_name,
|
|||
}
|
||||
|
||||
extern "C" gboolean
|
||||
mozilla_preference_set_boolean (const char *preference_name,
|
||||
gboolean new_boolean_value)
|
||||
mozilla_preference_set_boolean (const char *preference_name,
|
||||
gboolean new_boolean_value)
|
||||
{
|
||||
g_return_val_if_fail (preference_name != NULL, FALSE);
|
||||
|
||||
nsCOMPtr<nsIPref> pref = do_CreateInstance(PREF_ID);
|
||||
nsCOMPtr<nsIPref> pref = do_CreateInstance (NS_PREF_CONTRACTID);
|
||||
|
||||
if (pref)
|
||||
{
|
||||
nsresult rv = pref->SetBoolPref (preference_name,
|
||||
new_boolean_value ? PR_TRUE : PR_FALSE);
|
||||
|
||||
|
||||
return NS_SUCCEEDED (rv) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
@ -77,22 +89,227 @@ mozilla_preference_set_boolean (const char *preference_name,
|
|||
}
|
||||
|
||||
extern "C" gboolean
|
||||
mozilla_preference_set_int (const char *preference_name,
|
||||
gint new_int_value)
|
||||
mozilla_preference_set_int (const char *preference_name,
|
||||
gint new_int_value)
|
||||
{
|
||||
g_return_val_if_fail (preference_name != NULL, FALSE);
|
||||
|
||||
nsCOMPtr<nsIPref> pref = do_CreateInstance(PREF_ID);
|
||||
nsCOMPtr<nsIPref> pref = do_CreateInstance (NS_PREF_CONTRACTID);
|
||||
|
||||
if (pref)
|
||||
{
|
||||
nsresult rv = pref->SetIntPref (preference_name, new_int_value);
|
||||
|
||||
|
||||
return NS_SUCCEEDED (rv) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// pref->SetBoolPref("nglayout.widget.gfxscrollbars", PR_FALSE);
|
||||
// pref->SetBoolPref("security.checkloaduri", PR_FALSE);
|
||||
extern "C" gboolean
|
||||
mozilla_gconf_handle_gconf_error (GError **error)
|
||||
{
|
||||
static gboolean shown_dialog = FALSE;
|
||||
|
||||
g_return_val_if_fail (error != NULL, FALSE);
|
||||
|
||||
if (*error != NULL) {
|
||||
g_warning (_("GConf error:\n %s"), (*error)->message);
|
||||
if (!shown_dialog) {
|
||||
char *message;
|
||||
GtkWidget *dialog;
|
||||
|
||||
shown_dialog = TRUE;
|
||||
|
||||
message = g_strdup_printf (_("GConf error:\n %s\n"
|
||||
"All further errors shown "
|
||||
"only on terminal"),
|
||||
(*error)->message);
|
||||
|
||||
dialog = gnome_error_dialog (message);
|
||||
}
|
||||
g_error_free (*error);
|
||||
*error = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static guint gconf_proxy_changed_connection = 0;
|
||||
static guint gconf_use_http_proxy_changed_connection = 0;
|
||||
|
||||
static void
|
||||
preferneces_proxy_changed_callback (GConfClient* client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
gpointer user_data)
|
||||
{
|
||||
preferences_proxy_sync_mozilla_with_gconf ();
|
||||
}
|
||||
|
||||
static void
|
||||
preferences_use_proxy_changed_callback (GConfClient* client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
gpointer user_data)
|
||||
{
|
||||
preferences_proxy_sync_mozilla_with_gconf ();
|
||||
}
|
||||
|
||||
static void
|
||||
preferences_add_gconf_proxy_connections (void)
|
||||
{
|
||||
GConfClient *gconf_client;
|
||||
GError *error = NULL;
|
||||
|
||||
gconf_client = preferences_get_global_gconf_client ();
|
||||
g_return_if_fail (GCONF_IS_CLIENT (gconf_client));
|
||||
|
||||
gconf_proxy_changed_connection = gconf_client_notify_add (gconf_client,
|
||||
PROXY_KEY,
|
||||
preferneces_proxy_changed_callback,
|
||||
NULL,
|
||||
NULL,
|
||||
&error);
|
||||
mozilla_gconf_handle_gconf_error (&error);
|
||||
|
||||
gconf_use_http_proxy_changed_connection = gconf_client_notify_add (gconf_client,
|
||||
USE_PROXY_KEY,
|
||||
preferences_use_proxy_changed_callback,
|
||||
NULL,
|
||||
NULL,
|
||||
&error);
|
||||
mozilla_gconf_handle_gconf_error (&error);
|
||||
}
|
||||
|
||||
static void
|
||||
preferences_remove_gconf_proxy_connections (void)
|
||||
{
|
||||
GConfClient *gconf_client;
|
||||
|
||||
gconf_client = preferences_get_global_gconf_client ();
|
||||
g_return_if_fail (GCONF_IS_CLIENT (gconf_client));
|
||||
|
||||
gconf_client_notify_remove (gconf_client, gconf_proxy_changed_connection);
|
||||
gconf_proxy_changed_connection = 0;
|
||||
|
||||
gconf_client_notify_remove (gconf_client, gconf_use_http_proxy_changed_connection);
|
||||
gconf_use_http_proxy_changed_connection = 0;
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
mozilla_gconf_listen_for_proxy_changes (void)
|
||||
{
|
||||
static gboolean once = FALSE;
|
||||
GConfClient *gconf_client;
|
||||
GError *error = NULL;
|
||||
|
||||
if (once == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
once = TRUE;
|
||||
|
||||
/* Sync the first time */
|
||||
preferences_proxy_sync_mozilla_with_gconf ();
|
||||
|
||||
gconf_client = preferences_get_global_gconf_client ();
|
||||
|
||||
g_return_if_fail (GCONF_IS_CLIENT (gconf_client));
|
||||
|
||||
/* Let gconf know about ~/.gconf/system/gnome-vfs */
|
||||
gconf_client_add_dir (gconf_client,
|
||||
SYSTEM_GNOME_VFS_PATH,
|
||||
GCONF_CLIENT_PRELOAD_NONE,
|
||||
&error);
|
||||
|
||||
mozilla_gconf_handle_gconf_error (&error);
|
||||
|
||||
preferences_add_gconf_proxy_connections ();
|
||||
|
||||
g_atexit (preferences_remove_gconf_proxy_connections);
|
||||
}
|
||||
|
||||
static GConfClient *global_gconf_client = NULL;
|
||||
|
||||
static void
|
||||
preferences_unref_global_gconf_client (void)
|
||||
{
|
||||
if (global_gconf_client == NULL) {
|
||||
gtk_object_unref (GTK_OBJECT (global_gconf_client));
|
||||
}
|
||||
|
||||
global_gconf_client = NULL;
|
||||
}
|
||||
|
||||
/* Get the default gconf client. Initialize gconf if needed. */
|
||||
static GConfClient *
|
||||
preferences_get_global_gconf_client (void)
|
||||
{
|
||||
/* Initialize gconf if needed */
|
||||
if (!gconf_is_initialized ()) {
|
||||
GError *error = NULL;
|
||||
char *argv[] = { "nautilus-mozilla-component", NULL };
|
||||
|
||||
if (!gconf_init (1, argv, &error)) {
|
||||
|
||||
if (mozilla_gconf_handle_gconf_error (&error)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (global_gconf_client == NULL) {
|
||||
global_gconf_client = gconf_client_get_default ();
|
||||
g_atexit (preferences_unref_global_gconf_client);
|
||||
}
|
||||
|
||||
return global_gconf_client;
|
||||
}
|
||||
|
||||
/* Setup http proxy prefrecens. This is done by using gconf to read the
|
||||
* /system/gnome-vfs/proxy preference and then seting this information
|
||||
* for the mozilla networking library via mozilla preferences.
|
||||
*/
|
||||
static void
|
||||
preferences_proxy_sync_mozilla_with_gconf (void)
|
||||
{
|
||||
GConfClient *gconf_client;
|
||||
char *proxy_string = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
gconf_client = preferences_get_global_gconf_client ();
|
||||
|
||||
g_return_if_fail (GCONF_IS_CLIENT (gconf_client));
|
||||
|
||||
if (gconf_client_get_bool (gconf_client, USE_PROXY_KEY, &error)) {
|
||||
proxy_string = gconf_client_get_string (gconf_client, PROXY_KEY, &error);
|
||||
if (!mozilla_gconf_handle_gconf_error (&error)) {
|
||||
if (proxy_string != NULL) {
|
||||
char *proxy, *port;
|
||||
port = strchr (proxy_string, ':');
|
||||
if (port != NULL) {
|
||||
proxy = g_strdup (proxy_string);
|
||||
proxy [port - proxy_string] = '\0';
|
||||
port++;
|
||||
|
||||
mozilla_preference_set ("network.proxy.http", proxy);
|
||||
mozilla_preference_set_int ("network.proxy.http_port", atoi (port));
|
||||
|
||||
/* 1, Configure proxy settings manually */
|
||||
mozilla_preference_set_int ("network.proxy.type", 1);
|
||||
|
||||
g_free (proxy_string);
|
||||
g_free (proxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Default is 3, which conects to internet hosts directly */
|
||||
mozilla_preference_set_int ("network.proxy.type", 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,17 +29,30 @@
|
|||
#define MOZILLA_PREFERENCES_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <gconf/gconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
gboolean mozilla_preference_set (const char *preference_name,
|
||||
const char *new_value);
|
||||
gboolean mozilla_preference_set_boolean (const char *preference_name,
|
||||
gboolean new_boolean_value);
|
||||
gboolean mozilla_preference_set_int (const char *preference_name,
|
||||
gint new_int_value);
|
||||
gboolean mozilla_preference_set (const char *preference_name,
|
||||
const char *new_value);
|
||||
gboolean mozilla_preference_set_boolean (const char *preference_name,
|
||||
gboolean new_boolean_value);
|
||||
gboolean mozilla_preference_set_int (const char *preference_name,
|
||||
gint new_int_value);
|
||||
|
||||
|
||||
/* Handle a gconf error. Post an error dialog only the first time an error occurs.
|
||||
* Return TRUE if there was an error. FALSE if there was no error.
|
||||
*/
|
||||
gboolean mozilla_gconf_handle_gconf_error (GError **error);
|
||||
|
||||
|
||||
/* Listen for proxy changes on the gconf end of things and route the changes to
|
||||
* the mozilla universe.
|
||||
*/
|
||||
void mozilla_gconf_listen_for_proxy_changes (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
#include "mozilla-events.h"
|
||||
|
||||
#include <bonobo/bonobo-control.h>
|
||||
#include <gconf/gconf.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include <libgnomeui/gnome-stock.h>
|
||||
|
@ -61,15 +59,15 @@
|
|||
#define NUM_ELEMENTS_IN_ARRAY(_a) (sizeof (_a) / sizeof ((_a)[0]))
|
||||
|
||||
#ifdef EAZEL_SERVICES
|
||||
EazelProxy_UserControl gl_user_control = CORBA_OBJECT_NIL;
|
||||
static EazelProxy_UserControl global_user_control = CORBA_OBJECT_NIL;
|
||||
#endif
|
||||
|
||||
struct NautilusMozillaContentViewDetails {
|
||||
char *uri;
|
||||
GtkWidget *mozilla;
|
||||
NautilusView *nautilus_view;
|
||||
GdkCursor *busy_cursor;
|
||||
gboolean got_called_by_nautilus;
|
||||
char *uri;
|
||||
GtkWidget *mozilla;
|
||||
NautilusView *nautilus_view;
|
||||
GdkCursor *busy_cursor;
|
||||
gboolean got_called_by_nautilus;
|
||||
};
|
||||
|
||||
static void nautilus_mozilla_content_view_initialize_class (NautilusMozillaContentViewClass *klass);
|
||||
|
@ -78,6 +76,7 @@ static void nautilus_mozilla_content_view_destroy (GtkObject
|
|||
static void mozilla_load_location_callback (NautilusView *nautilus_view,
|
||||
const char *location,
|
||||
NautilusMozillaContentView *view);
|
||||
|
||||
/* Mozilla embed widget callbacks */
|
||||
static void mozilla_title_changed_callback (GtkMozEmbed *mozilla,
|
||||
gpointer user_data);
|
||||
|
@ -100,17 +99,18 @@ static gint mozilla_dom_mouse_click_callback (GtkMozEmbed
|
|||
gpointer dom_event,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
/* Other mozilla content view functions */
|
||||
static void mozilla_content_view_set_busy_cursor (NautilusMozillaContentView *view);
|
||||
static void mozilla_content_view_clear_busy_cursor (NautilusMozillaContentView *view);
|
||||
static gboolean mozilla_is_uri_handled_by_nautilus (const char *uri);
|
||||
static gboolean mozilla_is_uri_handled_by_mozilla (const char *uri);
|
||||
|
||||
static char * mozilla_translate_uri_if_needed (NautilusMozillaContentView *view,
|
||||
const char *uri);
|
||||
|
||||
static char * mozilla_untranslate_uri_if_needed (NautilusMozillaContentView *view,
|
||||
static char * mozilla_untranslate_uri_if_needed (NautilusMozillaContentView *view,
|
||||
const char *uri);
|
||||
static void mozilla_content_view_one_time_happenings (void);
|
||||
|
||||
|
||||
#ifdef EAZEL_SERVICES
|
||||
|
||||
|
@ -158,155 +158,20 @@ nautilus_mozilla_content_view_initialize_class (NautilusMozillaContentViewClass
|
|||
object_class->destroy = nautilus_mozilla_content_view_destroy;
|
||||
}
|
||||
|
||||
/* Handle a gconf error. Post an error dialog only the first time an error occurs.
|
||||
* Return TRUE if there was an error. FALSE if there was no error.
|
||||
*/
|
||||
static gboolean
|
||||
handle_gconf_error (GError **error)
|
||||
{
|
||||
static gboolean shown_dialog = FALSE;
|
||||
|
||||
g_return_val_if_fail (error != NULL, FALSE);
|
||||
|
||||
if (*error != NULL) {
|
||||
g_warning (_("GConf error:\n %s"), (*error)->message);
|
||||
if (!shown_dialog) {
|
||||
char *message;
|
||||
GtkWidget *dialog;
|
||||
|
||||
shown_dialog = TRUE;
|
||||
|
||||
message = g_strdup_printf (_("GConf error:\n %s\n"
|
||||
"All further errors shown "
|
||||
"only on terminal"),
|
||||
(*error)->message);
|
||||
|
||||
dialog = gnome_error_dialog (message);
|
||||
}
|
||||
g_error_free (*error);
|
||||
*error = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Setup http proxy prefrecens. This is done by using gconf to read the
|
||||
* /system/gnome-vfs/proxy preference and then seting this information
|
||||
* for the mozilla networking library via mozilla preferences.
|
||||
*/
|
||||
static void
|
||||
mozilla_content_view_set_proxy_preferences (NautilusMozillaContentView *view)
|
||||
{
|
||||
GConfClient *gconf_client;
|
||||
char *proxy_string = NULL;
|
||||
static const char PROXY_KEY[] = "/system/gnome-vfs/http-proxy";
|
||||
static const char USE_PROXY_KEY[] = "/system/gnome-vfs/use-http-proxy";
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_MOZILLA_CONTENT_VIEW (view));
|
||||
|
||||
/* Initialize gconf if needed */
|
||||
if (!gconf_is_initialized ()) {
|
||||
GError *error = NULL;
|
||||
char *argv[] = { "nautilus-mozilla-component", NULL };
|
||||
|
||||
if (!gconf_init (1, argv, &error)) {
|
||||
|
||||
if (handle_gconf_error (&error)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gconf_client = gconf_client_get_default ();
|
||||
|
||||
if (gconf_client != NULL) {
|
||||
GError *error = NULL;
|
||||
|
||||
if (gconf_client_get_bool (gconf_client, USE_PROXY_KEY, &error)) {
|
||||
proxy_string = gconf_client_get_string (gconf_client, PROXY_KEY, &error);
|
||||
if (handle_gconf_error (&error)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (proxy_string != NULL) {
|
||||
char *proxy, *port;
|
||||
port = strchr (proxy_string, ':');
|
||||
if (port != NULL) {
|
||||
proxy = g_strdup (proxy_string);
|
||||
proxy [port - proxy_string] = '\0';
|
||||
port++;
|
||||
|
||||
mozilla_preference_set ("network.proxy.http", proxy);
|
||||
mozilla_preference_set_int ("network.proxy.http_port", atoi (port));
|
||||
|
||||
/* 1, Configure proxy settings manually */
|
||||
mozilla_preference_set_int ("network.proxy.type", 1);
|
||||
|
||||
g_free (proxy_string);
|
||||
g_free (proxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Default is 3, which conects to internet hosts directly */
|
||||
mozilla_preference_set_int ("network.proxy.type", 3);
|
||||
}
|
||||
|
||||
gtk_object_unref (GTK_OBJECT (gconf_client));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mozilla_content_view_one_time_happenings (NautilusMozillaContentView *view)
|
||||
{
|
||||
static gboolean once = FALSE;
|
||||
|
||||
if (once == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
once = TRUE;
|
||||
|
||||
/* Tell the gecko layout engine to use GTK scrollbars. Currently BROKEN. */
|
||||
mozilla_preference_set_boolean ("nglayout.widget.gfxscrollbars", FALSE);
|
||||
|
||||
/* Tell the security manager to allow ftp:// and file:// content through. */
|
||||
mozilla_preference_set_boolean ("security.checkloaduri", FALSE);
|
||||
|
||||
/* Change http protocol user agent to include the string 'Nautilus' */
|
||||
mozilla_preference_set ("general.useragent.misc", "Nautilus/1.0");
|
||||
|
||||
/* We dont want to use the proxy for localhost */
|
||||
mozilla_preference_set ("network.proxy.no_proxies_on", "localhost");
|
||||
|
||||
/* Locate and set proxy preferences */
|
||||
mozilla_content_view_set_proxy_preferences (view);
|
||||
|
||||
|
||||
#ifdef EAZEL_SERVICES
|
||||
if (ammonite_init ((PortableServer_POA) bonobo_poa)) {
|
||||
gl_user_control = ammonite_get_user_control ();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_mozilla_content_view_initialize (NautilusMozillaContentView *view)
|
||||
{
|
||||
view->details = g_new0 (NautilusMozillaContentViewDetails, 1);
|
||||
|
||||
view->details->uri = NULL;
|
||||
|
||||
view->details->got_called_by_nautilus = FALSE;
|
||||
|
||||
/* Conjure up the beast. May God have mercy on our souls. */
|
||||
view->details->mozilla = gtk_moz_embed_new ();
|
||||
|
||||
/* Do preference/environment setup that needs to happen only once */
|
||||
mozilla_content_view_one_time_happenings (view);
|
||||
/* Do preference/environment setup that needs to happen only once.
|
||||
* We need to do this right after the first gtkmozembed widget gets
|
||||
* created, otherwise the mozilla runtime environment is not properly
|
||||
* setup.
|
||||
*/
|
||||
mozilla_content_view_one_time_happenings ();
|
||||
|
||||
/* Add callbacks to the beast */
|
||||
gtk_signal_connect_while_alive (GTK_OBJECT (view->details->mozilla),
|
||||
|
@ -376,7 +241,7 @@ nautilus_mozilla_content_view_destroy (GtkObject *object)
|
|||
#endif
|
||||
|
||||
view = NAUTILUS_MOZILLA_CONTENT_VIEW (object);
|
||||
|
||||
|
||||
g_free (view->details->uri);
|
||||
|
||||
if (view->details->busy_cursor != NULL) {
|
||||
|
@ -1233,7 +1098,7 @@ eazel_services_scheme_translate (NautilusMozillaContentView *view,
|
|||
char *ret = NULL;
|
||||
AmmoniteError err;
|
||||
|
||||
if (CORBA_OBJECT_NIL == gl_user_control) {
|
||||
if (CORBA_OBJECT_NIL == global_user_control) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1391,3 +1256,35 @@ test_make_full_uri_from_relative (void)
|
|||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
mozilla_content_view_one_time_happenings (void)
|
||||
{
|
||||
static gboolean once = FALSE;
|
||||
|
||||
if (once == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
once = TRUE;
|
||||
|
||||
g_print ("%s()\n", __FUNCTION__);
|
||||
|
||||
/* Tell the security manager to allow ftp:// and file:// content through. */
|
||||
mozilla_preference_set_boolean ("security.checkloaduri", FALSE);
|
||||
|
||||
/* Change http protocol user agent to include the string 'Nautilus' */
|
||||
mozilla_preference_set ("general.useragent.misc", "Nautilus/1.0");
|
||||
|
||||
/* We dont want to use the proxy for localhost */
|
||||
mozilla_preference_set ("network.proxy.no_proxies_on", "localhost");
|
||||
|
||||
/* Setup routing of proxy preferences from gconf to mozilla */
|
||||
mozilla_gconf_listen_for_proxy_changes ();
|
||||
|
||||
#ifdef EAZEL_SERVICES
|
||||
if (ammonite_init ((PortableServer_POA) bonobo_poa)) {
|
||||
global_user_control = ammonite_get_user_control ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue