aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog56
-rw-r--r--embed/Makefile.am2
-rw-r--r--embed/ephy-embed-popup-control.c645
-rw-r--r--embed/ephy-embed-popup-control.h20
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp46
-rw-r--r--lib/ephy-dialog.c68
-rw-r--r--lib/ephy-dnd.c2
-rw-r--r--lib/ephy-gui.c66
-rw-r--r--lib/ephy-gui.h7
-rw-r--r--lib/ephy-string.c397
-rw-r--r--lib/ephy-string.h37
-rw-r--r--src/ephy-nautilus-view.c377
-rw-r--r--src/session.c8
-rwxr-xr-xsrc/statusbar.c4
-rwxr-xr-xsrc/toolbar.c4
15 files changed, 785 insertions, 954 deletions
diff --git a/ChangeLog b/ChangeLog
index 9bc432885..4f9f98705 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,61 @@
2003-06-16 Marco Pesenti Gritti <marco@it.gnome.org>
+ * embed/Makefile.am:
+ * embed/ephy-embed-popup-control.c:
+ (ephy_embed_popup_control_get_type),
+ (ephy_embed_popup_control_set_property),
+ (ephy_embed_popup_control_get_property),
+ (ephy_embed_popup_control_class_init),
+ (ephy_embed_popup_control_init),
+ (ephy_embed_popup_control_finalize), (get_popup_path),
+ (ephy_embed_popup_control_show), (setup_element_menu),
+ (setup_document_menu), (ephy_embed_popup_control_set_event),
+ (ephy_embed_popup_control_connect_verbs),
+ (ephy_embed_popup_control_get_event),
+ (embed_popup_copy_location_cmd), (embed_popup_copy_email_cmd),
+ (embed_popup_copy_link_location_cmd), (save_property_url),
+ (embed_popup_open_link_cmd), (embed_popup_download_link_cmd),
+ (embed_popup_save_image_as_cmd), (background_download_completed),
+ (embed_popup_set_image_as_background_cmd),
+ (embed_popup_copy_image_location_cmd), (save_url),
+ (embed_popup_save_page_as_cmd),
+ (embed_popup_save_background_as_cmd), (embed_popup_open_frame_cmd),
+ (embed_popup_reload_frame_cmd), (embed_popup_open_image_cmd),
+ (embed_popup_copy_to_clipboard):
+ * embed/ephy-embed-popup-control.h:
+
+ Merge with popup control, we dont need it for bonobo
+ window anymore.
+
+ * embed/mozilla/mozilla-embed-single.cpp:
+
+ Do not override the UA but set vendor prefs so
+ that mozilla can build it correctly.
+
+ * lib/ephy-dialog.c: (get_radio_button_active_index),
+ (set_config_from_radiobuttongroup),
+ (set_radiobuttongroup_from_config), (prefs_set_group_sensitivity),
+ (impl_get_value):
+ * lib/ephy-dnd.c: (ephy_dnd_node_list_extract_nodes):
+ * lib/ephy-gui.c:
+ * lib/ephy-gui.h:
+ * lib/ephy-string.c: (ephy_string_shorten), (ephy_string_to_int),
+ (ephy_string_strip_chr), (ephy_string_elide_underscores):
+ * lib/ephy-string.h:
+ * src/ephy-nautilus-view.c: (ephy_nautilus_view_instance_init),
+ (gnv_embed_context_menu_cb), (gnv_embed_location_cb),
+ (gnv_view_from_popup), (gnv_popup_cmd_new_window),
+ (gnv_popup_cmd_image_in_new_window),
+ (gnv_popup_cmd_frame_in_new_window), (gnv_cmd_file_print),
+ (gnv_embed_zoom_change_cb):
+ * src/session.c: (session_load):
+ * src/statusbar.c: (statusbar_set_message):
+ * src/toolbar.c: (toolbar_ensure_action):
+
+ Cleanup helpers (remove unused and rename.
+
+2003-06-16 Marco Pesenti Gritti <marco@it.gnome.org>
+
* data/ui/nautilus-epiphany-view.xml.in:
Remove some obsolete entries.
diff --git a/embed/Makefile.am b/embed/Makefile.am
index 6355dbac2..f26c57dc0 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -27,8 +27,6 @@ libephyembed_la_SOURCES = \
ephy-embed-event.h \
ephy-embed-persist.c \
ephy-embed-persist.h \
- ephy-embed-popup.c \
- ephy-embed-popup.h \
ephy-embed-popup-control.c \
ephy-embed-popup-control.h \
ephy-embed-prefs.h \
diff --git a/embed/ephy-embed-popup-control.c b/embed/ephy-embed-popup-control.c
index 866c6789f..2f8b20b8a 100644
--- a/embed/ephy-embed-popup-control.c
+++ b/embed/ephy-embed-popup-control.c
@@ -17,23 +17,131 @@
*/
#include "ephy-embed-popup-control.h"
-#include "ephy-gobject-misc.h"
#include "ephy-bonobo-extensions.h"
+#include "ephy-embed-utils.h"
+#include "ephy-prefs.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-file-helpers.h"
#include <gtk/gtkmain.h>
+#include <string.h>
+#include <bonobo/bonobo-ui-component.h>
+#include <gtk/gtkclipboard.h>
+#include <libgnome/gnome-exec.h>
-enum
+typedef enum
{
- PROP_0,
- PROP_BONOBO_CONTROL
-};
+ EMBED_POPUP_INPUT,
+ EMBED_POPUP_DOCUMENT,
+ EMBED_POPUP_ELEMENT
+} EmbedPopupType;
struct EphyEmbedPopupControlPrivate
{
+ EphyEmbedEvent *event;
+ EphyEmbed *embed;
+ EmbedEventContext context;
+ BonoboUIComponent *ui_component;
+ char *selection;
+ EmbedPopupType popup_type;
BonoboControl *control;
};
static void
+embed_popup_copy_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_copy_email_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_copy_link_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_open_link_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_download_link_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_save_image_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_set_image_as_background_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_copy_image_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_save_page_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_save_background_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_open_frame_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_reload_frame_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+
+static void
+embed_popup_open_image_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname);
+static void
+embed_popup_copy_to_clipboard (EphyEmbedPopupControl *popup, const char *text);
+
+#define DOCUMENT_POPUP_PATH "/popups/EphyEmbedDocumentPopup"
+#define ELEMENT_POPUP_PATH "/popups/EphyEmbedElementPopup"
+#define INPUT_POPUP_PATH "/popups/EphyEmbedInputPopup"
+
+#define EPHY_POPUP_NAVIGATION_ITEMS_PLACEHOLDER "/popups/EphyEmbedDocumentPopup/NavigationItems"
+#define EPHY_POPUP_LINK_ITEMS_PLACEHOLDER "/popups/EphyEmbedElementPopup/LinkItems"
+#define EPHY_POPUP_EMAIL_LINK_ITEMS_PLACEHOLDER "/popups/EphyEmbedElementPopup/EmailLinkItems"
+#define EPHY_POPUP_IMAGE_ITEMS_PLACEHOLDER "/popups/EphyEmbedElementPopup/ImageItems"
+#define EPHY_POPUP_FRAME_ITEMS_PLACEHOLDER "/popups/EphyEmbedDocumentPopup/FrameItems"
+#define EPHY_POPUP_BETWEEN_ELEMENTS1_PLACEHOLDER "/popups/EphyEmbedElementPopup/BetweenElements1"
+#define EPHY_POPUP_SAVE_BG_PATH "/commands/DPSaveBackgroundAs"
+#define EPHY_POPUP_OPEN_IMAGE_PATH "/commands/EPOpenImage"
+
+BonoboUIVerb embed_popup_verbs [] = {
+ BONOBO_UI_VERB ("EPCopyLinkLocation", (BonoboUIVerbFn)embed_popup_copy_link_location_cmd),
+ BONOBO_UI_VERB ("EPDownloadLink", (BonoboUIVerbFn)embed_popup_download_link_cmd),
+ BONOBO_UI_VERB ("EPOpenLink", (BonoboUIVerbFn)embed_popup_open_link_cmd),
+ BONOBO_UI_VERB ("EPOpenImage", (BonoboUIVerbFn)embed_popup_open_image_cmd),
+ BONOBO_UI_VERB ("EPSaveImageAs", (BonoboUIVerbFn)embed_popup_save_image_as_cmd),
+ BONOBO_UI_VERB ("EPSetImageAsBackground", (BonoboUIVerbFn)embed_popup_set_image_as_background_cmd),
+ BONOBO_UI_VERB ("EPCopyImageLocation", (BonoboUIVerbFn)embed_popup_copy_image_location_cmd),
+
+ BONOBO_UI_VERB ("DPCopyLocation", (BonoboUIVerbFn)embed_popup_copy_location_cmd),
+ BONOBO_UI_VERB ("EPCopyEmail", (BonoboUIVerbFn)embed_popup_copy_email_cmd),
+ BONOBO_UI_VERB ("DPSavePageAs", (BonoboUIVerbFn)embed_popup_save_page_as_cmd),
+ BONOBO_UI_VERB ("DPSaveBackgroundAs", (BonoboUIVerbFn)embed_popup_save_background_as_cmd),
+ BONOBO_UI_VERB ("DPOpenFrame", (BonoboUIVerbFn)embed_popup_open_frame_cmd),
+ BONOBO_UI_VERB ("DPReloadFrame", (BonoboUIVerbFn)embed_popup_reload_frame_cmd),
+
+ BONOBO_UI_VERB_END
+};
+
+enum
+{
+ PROP_0,
+ PROP_BONOBO_CONTROL
+};
+
+static void
ephy_embed_popup_control_class_init (EphyEmbedPopupControlClass *klass);
static void
ephy_embed_popup_control_init (EphyEmbedPopupControl *gep);
@@ -52,22 +160,76 @@ ephy_embed_popup_control_get_property (GObject *object,
static void
ephy_embed_popup_control_set_control (EphyEmbedPopupControl *p,
BonoboControl *control);
+
+static GObjectClass *parent_class = NULL;
+
+GType
+ephy_embed_popup_control_get_type (void)
+{
+ static GType ephy_embed_popup_control_type = 0;
+
+ if (ephy_embed_popup_control_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyEmbedPopupControlClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_embed_popup_control_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EphyEmbedPopupControl),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_embed_popup_control_init
+ };
+
+
+ ephy_embed_popup_control_type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyEmbedPopupControl",
+ &our_info, 0);
+ }
+
+ return ephy_embed_popup_control_type;
+}
+
static void
-ephy_embed_popup_control_show_impl (EphyEmbedPopup *p,
- EphyEmbed *embed);
+ephy_embed_popup_control_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (object);
-static EphyEmbedPopupClass *parent_class = NULL;
+ switch (prop_id)
+ {
+ case PROP_BONOBO_CONTROL:
+ ephy_embed_popup_control_set_control (p, g_value_get_object (value));
+ break;
+ }
+}
-MAKE_GET_TYPE (ephy_embed_popup_control, "EphyEmbedPopupControl", EphyEmbedPopupControl,
- ephy_embed_popup_control_class_init, ephy_embed_popup_control_init,
- EPHY_EMBED_POPUP_TYPE);
+static void
+ephy_embed_popup_control_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (object);
+
+ switch (prop_id)
+ {
+ case PROP_BONOBO_CONTROL:
+ g_value_set_object (value, p->priv->control);
+ break;
+ }
+}
static void
ephy_embed_popup_control_class_init (EphyEmbedPopupControlClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = EPHY_EMBED_POPUP_CLASS (g_type_class_peek_parent (klass));
+ parent_class = g_type_class_peek_parent (klass);
object_class->finalize = ephy_embed_popup_control_finalize;
object_class->set_property = ephy_embed_popup_control_set_property;
@@ -80,8 +242,6 @@ ephy_embed_popup_control_class_init (EphyEmbedPopupControlClass *klass)
"Bonobo control",
BONOBO_TYPE_CONTROL,
G_PARAM_READWRITE));
-
- EPHY_EMBED_POPUP_CLASS (klass)->show = ephy_embed_popup_control_show_impl;
}
static void
@@ -89,6 +249,9 @@ ephy_embed_popup_control_init (EphyEmbedPopupControl *gep)
{
gep->priv = g_new0 (EphyEmbedPopupControlPrivate, 1);
gep->priv->control = NULL;
+ gep->priv->embed = NULL;
+ gep->priv->event = NULL;
+ gep->priv->ui_component = NULL;
}
static void
@@ -103,41 +266,16 @@ ephy_embed_popup_control_finalize (GObject *object)
g_return_if_fail (gep->priv != NULL);
- g_free (gep->priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
+ if (gep->priv->event)
+ {
+ g_object_unref (G_OBJECT (gep->priv->event));
+ }
-static void
-ephy_embed_popup_control_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (object);
-
- switch (prop_id)
- {
- case PROP_BONOBO_CONTROL:
- ephy_embed_popup_control_set_control (p, g_value_get_object (value));
- break;
- }
-}
+ g_free (gep->priv->selection);
-static void
-ephy_embed_popup_control_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (object);
+ g_free (gep->priv);
- switch (prop_id)
- {
- case PROP_BONOBO_CONTROL:
- g_value_set_object (value, p->priv->control);
- break;
- }
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
@@ -161,17 +299,38 @@ ephy_embed_popup_control_new (BonoboControl *control)
return p;
}
-static void
-ephy_embed_popup_control_show_impl (EphyEmbedPopup *pp,
- EphyEmbed *embed)
+static const char *
+get_popup_path (EphyEmbedPopupControl *p)
+{
+ const char *result = NULL;
+
+ switch (p->priv->popup_type)
+ {
+ case EMBED_POPUP_INPUT:
+ result = INPUT_POPUP_PATH;
+ break;
+ case EMBED_POPUP_ELEMENT:
+ result = ELEMENT_POPUP_PATH;
+ break;
+ case EMBED_POPUP_DOCUMENT:
+ result = DOCUMENT_POPUP_PATH;
+ break;
+ }
+
+ return result;
+}
+
+void
+ephy_embed_popup_control_show (EphyEmbedPopupControl *pp,
+ EphyEmbed *embed)
{
EphyEmbedPopupControl *p = EPHY_EMBED_POPUP_CONTROL (pp);
BonoboUIComponent *uic = bonobo_control_get_popup_ui_component (p->priv->control);
const char *path;
char *path_dst;
- ephy_embed_popup_set_embed (pp, embed);
- path = ephy_embed_popup_get_popup_path (pp);
+ p->priv->embed = embed;
+ path = get_popup_path (pp);
path_dst = g_strdup_printf ("/popups/button%d", 2);
/* this is a hack because bonobo apis for showing popups are broken */
@@ -179,7 +338,389 @@ ephy_embed_popup_control_show_impl (EphyEmbedPopup *pp,
bonobo_control_do_popup (p->priv->control, 2,
gtk_get_current_event_time ());
+}
+
+static void
+setup_element_menu (EphyEmbedPopupControl *p)
+{
+ gboolean is_link, is_image, is_email_link;
+
+ is_image = p->priv->context & EMBED_CONTEXT_IMAGE;
+ is_email_link = p->priv->context & EMBED_CONTEXT_EMAIL_LINK;
+ is_link = (p->priv->context & EMBED_CONTEXT_LINK) && !is_email_link;
+
+ ephy_bonobo_set_hidden (p->priv->ui_component,
+ EPHY_POPUP_LINK_ITEMS_PLACEHOLDER,
+ !is_link);
+ ephy_bonobo_set_hidden (p->priv->ui_component,
+ EPHY_POPUP_IMAGE_ITEMS_PLACEHOLDER,
+ !is_image);
+ ephy_bonobo_set_hidden (p->priv->ui_component,
+ EPHY_POPUP_EMAIL_LINK_ITEMS_PLACEHOLDER,
+ !is_email_link);
+ ephy_bonobo_set_hidden (p->priv->ui_component,
+ EPHY_POPUP_BETWEEN_ELEMENTS1_PLACEHOLDER,
+ !is_image || (!is_link && !is_email_link));
+}
+
+static void
+setup_document_menu (EphyEmbedPopupControl *p)
+{
+ gboolean is_framed;
+ const GValue *value;
+ gboolean has_background;
+
+ ephy_embed_event_get_property (p->priv->event,
+ "framed_page", &value);
+ is_framed = g_value_get_int (value);
+ ephy_bonobo_set_hidden (BONOBO_UI_COMPONENT(p->priv->ui_component),
+ EPHY_POPUP_FRAME_ITEMS_PLACEHOLDER, !is_framed);
+
+ has_background = ephy_embed_event_has_property (p->priv->event,
+ "background_image");
+ ephy_bonobo_set_hidden (BONOBO_UI_COMPONENT(p->priv->ui_component),
+ EPHY_POPUP_SAVE_BG_PATH, !has_background);
+}
- g_free (path_dst);
+void
+ephy_embed_popup_control_set_event (EphyEmbedPopupControl *p,
+ EphyEmbedEvent *event)
+{
+ EmbedEventContext context;
+
+ if (p->priv->event)
+ {
+ g_object_unref (G_OBJECT (p->priv->event));
+ }
+
+ ephy_embed_event_get_context (event, &context);
+
+ p->priv->context = context;
+
+ p->priv->event = event;
+ g_object_ref (G_OBJECT(event));
+
+ if ((p->priv->context & EMBED_CONTEXT_LINK) ||
+ (p->priv->context & EMBED_CONTEXT_EMAIL_LINK) ||
+ (p->priv->context & EMBED_CONTEXT_IMAGE))
+ {
+ setup_element_menu (p);
+ p->priv->popup_type = EMBED_POPUP_ELEMENT;
+ }
+ else if (p->priv->context & EMBED_CONTEXT_INPUT)
+ {
+ p->priv->popup_type = EMBED_POPUP_INPUT;
+ }
+ else
+ {
+ setup_document_menu (p);
+ p->priv->popup_type = EMBED_POPUP_DOCUMENT;
+ }
}
+void
+ephy_embed_popup_control_connect_verbs (EphyEmbedPopupControl *p,
+ BonoboUIComponent *ui_component)
+{
+
+ p->priv->ui_component = BONOBO_UI_COMPONENT (ui_component);
+
+ bonobo_ui_component_add_verb_list_with_data (BONOBO_UI_COMPONENT(ui_component),
+ embed_popup_verbs,
+ p);
+}
+
+EphyEmbedEvent *
+ephy_embed_popup_control_get_event (EphyEmbedPopupControl *p)
+{
+ g_return_val_if_fail (IS_EPHY_EMBED_POPUP_CONTROL (p), NULL);
+
+ return p->priv->event;
+}
+
+static void
+embed_popup_copy_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ char *location;
+ ephy_embed_get_location (popup->priv->embed, FALSE, &location);
+ embed_popup_copy_to_clipboard (popup, location);
+ g_free (location);
+}
+
+static void
+embed_popup_copy_email_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+
+ info = ephy_embed_popup_control_get_event (popup);
+ ephy_embed_event_get_property (info, "email", &value);
+ location = g_value_get_string (value);
+ embed_popup_copy_to_clipboard (popup, location);
+}
+
+static void
+embed_popup_copy_link_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+
+ info = ephy_embed_popup_control_get_event (popup);
+ ephy_embed_event_get_property (info, "link", &value);
+ location = g_value_get_string (value);
+ embed_popup_copy_to_clipboard (popup, location);
+}
+
+static void
+save_property_url (EphyEmbedPopupControl *popup,
+ gboolean ask_dest,
+ gboolean show_progress,
+ const char *property)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+ GtkWidget *widget;
+ GtkWidget *window;
+ EphyEmbedPersist *persist;
+
+ info = ephy_embed_popup_control_get_event (popup);
+ ephy_embed_event_get_property (info, property, &value);
+ location = g_value_get_string (value);
+
+ widget = GTK_WIDGET (popup->priv->embed);
+ window = gtk_widget_get_toplevel (widget);
+
+ persist = ephy_embed_persist_new (popup->priv->embed);
+
+ ephy_embed_persist_set_source (persist, location);
+
+ if (show_progress)
+ {
+ ephy_embed_persist_set_flags (persist,
+ EMBED_PERSIST_SHOW_PROGRESS);
+ }
+
+ ephy_embed_utils_save (window,
+ CONF_STATE_DOWNLOADING_DIR,
+ ask_dest,
+ FALSE,
+ persist);
+}
+
+/* commands */
+
+static void
+embed_popup_open_link_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+
+ info = ephy_embed_popup_control_get_event (popup);
+ ephy_embed_event_get_property (info, "link", &value);
+ location = g_value_get_string (value);
+
+ ephy_embed_load_url (popup->priv->embed, location);
+}
+
+static void
+embed_popup_download_link_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ save_property_url (popup,
+ eel_gconf_get_boolean
+ (CONF_ASK_DOWNLOAD_DEST),
+ TRUE, "link");
+}
+
+static void
+embed_popup_save_image_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ save_property_url (popup, TRUE, FALSE, "image");
+}
+
+#define CONF_DESKTOP_BG_PICTURE "/desktop/gnome/background/picture_filename"
+#define CONF_DESKTOP_BG_TYPE "/desktop/gnome/background/picture_options"
+
+static void
+background_download_completed (EphyEmbedPersist *persist,
+ gpointer data)
+{
+ const char *bg;
+ char *type;
+
+ ephy_embed_persist_get_dest (persist, &bg);
+ eel_gconf_set_string (CONF_DESKTOP_BG_PICTURE, bg);
+
+ type = eel_gconf_get_string (CONF_DESKTOP_BG_TYPE);
+ if (type || strcmp (type, "none") == 0)
+ {
+ eel_gconf_set_string (CONF_DESKTOP_BG_TYPE,
+ "wallpaper");
+ }
+
+ g_free (type);
+
+ g_object_unref (persist);
+}
+
+static void
+embed_popup_set_image_as_background_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ char *dest, *base;
+ const GValue *value;
+ EphyEmbedPersist *persist;
+
+ info = ephy_embed_popup_control_get_event (popup);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+
+ persist = ephy_embed_persist_new (popup->priv->embed);
+
+ base = g_path_get_basename (location);
+ dest = g_build_filename (ephy_dot_dir (),
+ base, NULL);
+
+ ephy_embed_persist_set_source (persist, location);
+ ephy_embed_persist_set_dest (persist, dest);
+
+ ephy_embed_persist_save (persist);
+
+ g_signal_connect (persist, "completed",
+ G_CALLBACK (background_download_completed),
+ NULL);
+
+ g_free (dest);
+ g_free (base);
+}
+
+static void
+embed_popup_copy_image_location_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+
+ info = ephy_embed_popup_control_get_event (popup);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+ embed_popup_copy_to_clipboard (popup, location);
+}
+
+static void
+save_url (EphyEmbedPopupControl *popup,
+ gboolean ask_dest,
+ gboolean show_progress,
+ const char *url)
+{
+ GtkWidget *widget;
+ GtkWidget *window;
+ EphyEmbedPersist *persist;
+
+ widget = GTK_WIDGET (popup->priv->embed);
+ window = gtk_widget_get_toplevel (widget);
+
+ persist = ephy_embed_persist_new (popup->priv->embed);
+ ephy_embed_persist_set_source (persist, url);
+
+ if (show_progress)
+ {
+ ephy_embed_persist_set_flags (persist,
+ EMBED_PERSIST_SHOW_PROGRESS);
+ }
+
+ ephy_embed_utils_save (window,
+ CONF_STATE_DOWNLOADING_DIR,
+ ask_dest,
+ FALSE,
+ persist);
+}
+
+static void
+embed_popup_save_page_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ char *location;
+
+ ephy_embed_get_location (popup->priv->embed,
+ FALSE, &location);
+ save_url (popup, TRUE, FALSE, location);
+ g_free (location);
+}
+
+static void
+embed_popup_save_background_as_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ save_property_url (popup, TRUE, FALSE, "background_image");
+}
+
+static void
+embed_popup_open_frame_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ char *location;
+
+ ephy_embed_get_location (popup->priv->embed,
+ FALSE, &location);
+
+ ephy_embed_load_url (popup->priv->embed, location);
+
+ g_free (location);
+}
+
+static void
+embed_popup_reload_frame_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ /* FIXME implement */
+}
+
+static void
+embed_popup_open_image_cmd (BonoboUIComponent *uic,
+ EphyEmbedPopupControl *popup,
+ const char* verbname)
+{
+ EphyEmbedEvent *info;
+ const char *location;
+ const GValue *value;
+
+ info = ephy_embed_popup_control_get_event (popup);
+ ephy_embed_event_get_property (info, "image", &value);
+ location = g_value_get_string (value);
+
+ ephy_embed_load_url (popup->priv->embed, location);
+}
+
+static void
+embed_popup_copy_to_clipboard (EphyEmbedPopupControl *popup, const char *text)
+{
+ gtk_clipboard_set_text (gtk_clipboard_get (GDK_NONE),
+ text, -1);
+ gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY),
+ text, -1);
+}
diff --git a/embed/ephy-embed-popup-control.h b/embed/ephy-embed-popup-control.h
index 4f45efe5f..075e62a9b 100644
--- a/embed/ephy-embed-popup-control.h
+++ b/embed/ephy-embed-popup-control.h
@@ -19,9 +19,11 @@
#ifndef EPHY_EMBED_POPUP_CONTROL_H
#define EPHY_EMBED_POPUP_CONTROL_H
-#include "ephy-embed-popup.h"
#include <bonobo/bonobo-control.h>
+#include "ephy-embed.h"
+#include "ephy-embed-event.h"
+
G_BEGIN_DECLS
typedef struct EphyEmbedPopupControlClass EphyEmbedPopupControlClass;
@@ -44,18 +46,30 @@ typedef struct EphyEmbedPopupControlPrivate EphyEmbedPopupControlPrivate;
struct EphyEmbedPopupControl
{
- EphyEmbedPopup parent;
+ GObject parent;
EphyEmbedPopupControlPrivate *priv;
};
struct EphyEmbedPopupControlClass
{
- EphyEmbedPopupClass parent_class;
+ GObjectClass parent_class;
};
GType ephy_embed_popup_control_get_type (void);
+
EphyEmbedPopupControl *ephy_embed_popup_control_new (BonoboControl *control);
+EphyEmbedEvent *ephy_embed_popup_control_get_event (EphyEmbedPopupControl *p);
+
+void ephy_embed_popup_control_set_event (EphyEmbedPopupControl *p,
+ EphyEmbedEvent *event);
+
+void ephy_embed_popup_control_connect_verbs (EphyEmbedPopupControl *p,
+ BonoboUIComponent *ui_component);
+
+void ephy_embed_popup_control_show (EphyEmbedPopupControl *pp,
+ EphyEmbed *embed);
+
G_END_DECLS
#endif
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index aea368fe0..e5c69ab33 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -37,7 +37,6 @@
#include <time.h>
#include <libgnome/gnome-i18n.h>
#include <string.h>
-#include <sys/utsname.h>
#include "nsBuildID.h"
#include <nsICacheService.h>
#include <nsCOMPtr.h>
@@ -318,34 +317,6 @@ mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass)
shell_class->show_file_picker = impl_show_file_picker;
}
-static char *
-build_user_agent ()
-{
- static char *user_agent;
- struct utsname name;
- char *system;
-
- if (uname (&name) == 0)
- {
- system = g_strdup_printf ("%s %s",
- name.sysname,
- name.machine);
- }
- else
- {
- system = g_strdup ("Unknown");
- }
-
- user_agent = g_strdup_printf
- ("Mozilla/5.0 (X11; U; %s) Gecko/%d Epiphany/" VERSION,
- system,
- NS_BUILD_ID/100);
-
- g_free (system);
-
- return user_agent;
-}
-
static void
mozilla_set_default_prefs (MozillaEmbedSingle *mes)
{
@@ -418,11 +389,11 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes)
pref->SetBoolPref ("browser.enable_automatic_image_resizing", PR_TRUE);
/* User agent */
- char *user_agent;
- user_agent = build_user_agent ();
- pref->SetCharPref ("general.useragent.override", user_agent);
- g_free (user_agent);
+ /* FIXME We need to do this because mozilla doesnt set product
+ sub for embedding apps */
+ pref->SetCharPref ("general.useragent.vendor", "Epiphany");
+ pref->SetCharPref ("general.useragent.vendorSub", VERSION);
}
static char *
@@ -750,7 +721,7 @@ impl_get_encodings (EphyEmbedSingle *shell,
info->encoding = g_strdup (encodings[i].name);
- elided = ephy_str_elide_underscores (_(encodings[i].title));
+ elided = ephy_string_elide_underscores (_(encodings[i].title));
if (elide_underscores)
{
@@ -800,7 +771,7 @@ impl_get_language_groups (EphyEmbedSingle *shell,
info->group = lang_groups[i].group;
/* collate without underscores */
- elided = ephy_str_elide_underscores (info->title);
+ elided = ephy_string_elide_underscores (info->title);
info->key = g_utf8_collate_key (elided, -1);
g_free (elided);
@@ -1069,7 +1040,10 @@ impl_show_file_picker (EphyEmbedSingle *shell,
g_free (expanded_directory);
filePicker->InitWithGtkWidget (parentWidget, title, mode);
- filePicker->SetDefaultString (NS_ConvertUTF8toUCS2(file).get());
+ if (file)
+ {
+ filePicker->SetDefaultString (NS_ConvertUTF8toUCS2(file).get());
+ }
filePicker->SetDisplayDirectory (dir);
PRInt16 retval;
diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c
index 07126f7ce..6e891d3a2 100644
--- a/lib/ephy-dialog.c
+++ b/lib/ephy-dialog.c
@@ -238,13 +238,42 @@ set_config_from_optionmenu (GtkWidget *optionmenu, const char *config_name, GLis
}
}
+static int
+get_radio_button_active_index (GtkWidget *radiobutton)
+{
+ gint index;
+ GtkToggleButton *toggle_button;
+ gint i, length;
+ GSList *list;
+
+ /* get group list */
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton));
+ length = g_slist_length (list);
+
+ /* iterate over list to find active button */
+ for (i = 0; list != NULL; i++, list = g_slist_next (list))
+ {
+ /* get button and text */
+ toggle_button = GTK_TOGGLE_BUTTON (list->data);
+ if (gtk_toggle_button_get_active (toggle_button))
+ {
+ break;
+ }
+ }
+
+ /* check we didn't run off end */
+ g_assert (list != NULL);
+
+ /* return index (reverse order!) */
+ return index = (length - 1) - i;
+}
+
static void
set_config_from_radiobuttongroup (GtkWidget *radiobutton, const char *config_name, GList *senum)
{
- gint index;
+ int index;
- /* get value from radio button group */
- index = ephy_gui_gtk_radio_button_get (GTK_RADIO_BUTTON (radiobutton));
+ index = get_radio_button_active_index (radiobutton);
if (senum)
{
@@ -394,9 +423,31 @@ set_optionmenu_from_config (GtkWidget *optionmenu, const char *config_name, GLis
static void
set_radiobuttongroup_from_config (GtkWidget *radiobutton, const char *config_name, GList *senum)
{
- /* set it (finds the group for us) */
- ephy_gui_gtk_radio_button_set (GTK_RADIO_BUTTON (radiobutton),
- get_index (config_name, senum));
+ GtkToggleButton *button;
+ GSList *list;
+ gint length;
+ int index;
+
+ index = get_index (config_name, senum);
+
+ /* get the list */
+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton));
+
+ /* check out the length */
+ length = g_slist_length (list);
+
+ /* new buttons are *preppended* to the list, so button added as first
+ * has last position in the list */
+ index = (length - 1) - index;
+
+ /* find the right button */
+ button = GTK_TOGGLE_BUTTON (g_slist_nth_data (list, index));
+
+ /* set it... this will de-activate the others in the group */
+ if (gtk_toggle_button_get_active (button) == FALSE)
+ {
+ gtk_toggle_button_set_active (button, TRUE);
+ }
}
static void
@@ -518,8 +569,7 @@ prefs_set_group_sensitivity (GtkWidget *widget,
if (GTK_IS_RADIO_BUTTON (widget))
{
- group = ephy_gui_gtk_radio_button_get
- (GTK_RADIO_BUTTON(widget));
+ group = get_radio_button_active_index (widget);
}
else if (GTK_IS_TOGGLE_BUTTON (widget))
{
@@ -1103,7 +1153,7 @@ impl_get_value (EphyDialog *dialog,
{
int val;
g_value_init (value, G_TYPE_INT);
- val = ephy_gui_gtk_radio_button_get (GTK_RADIO_BUTTON(widget));
+ val = get_radio_button_active_index (widget);
g_value_set_int (value, val);
}
else if (GTK_IS_TOGGLE_BUTTON (widget))
diff --git a/lib/ephy-dnd.c b/lib/ephy-dnd.c
index 9f10c5a3c..75fb895d5 100644
--- a/lib/ephy-dnd.c
+++ b/lib/ephy-dnd.c
@@ -125,7 +125,7 @@ ephy_dnd_node_list_extract_nodes (const char *node_list)
db = ephy_node_db_get_by_name (nodes[i]);
g_return_val_if_fail (db != NULL, NULL);
- if (ephy_str_to_int (nodes[i + 1], &id))
+ if (ephy_string_to_int (nodes[i + 1], &id))
{
EphyNode *node;
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index d41d2a554..114344dab 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -62,70 +62,6 @@ ephy_gui_menu_position_under_widget (GtkMenu *menu,
g_print ("result %d\n", *y);
}
-/**
- * gul_gui_gtk_radio_button_get: get the active member of a radiobutton
- * group from one of the buttons in the group. This should be in GTK+!
- */
-gint
-ephy_gui_gtk_radio_button_get (GtkRadioButton *radio_button)
-{
- GtkToggleButton *toggle_button;
- gint i, length;
- GSList *list;
-
- /* get group list */
- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
- length = g_slist_length (list);
-
- /* iterate over list to find active button */
- for (i = 0; list != NULL; i++, list = g_slist_next (list))
- {
- /* get button and text */
- toggle_button = GTK_TOGGLE_BUTTON (list->data);
- if (gtk_toggle_button_get_active (toggle_button))
- {
- break;
- }
- }
-
- /* check we didn't run off end */
- g_assert (list != NULL);
-
- /* return index (reverse order!) */
- return (length - 1) - i;
-}
-
-/**
- * gul_gui_gtk_radio_button_set: set the active member of a radiobutton
- * group from one of the buttons in the group. This should be in GTK+!
- */
-void
-ephy_gui_gtk_radio_button_set (GtkRadioButton *radio_button, gint index)
-{
- GtkToggleButton *button;
- GSList *list;
- gint length;
-
- /* get the list */
- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button));
-
- /* check out the length */
- length = g_slist_length (list);
-
- /* new buttons are *preppended* to the list, so button added as first
- * has last position in the list */
- index = (length - 1) - index;
-
- /* find the right button */
- button = GTK_TOGGLE_BUTTON (g_slist_nth_data (list, index));
-
- /* set it... this will de-activate the others in the group */
- if (gtk_toggle_button_get_active (button) == FALSE)
- {
- gtk_toggle_button_set_active (button, TRUE);
- }
-}
-
gboolean
ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename)
{
@@ -153,7 +89,7 @@ ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename)
return res;
}
-void
+void
ephy_gui_help (GtkWindow *parent,
const char *file_name,
const char *link_id)
diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h
index 4db9caffb..ee2eeb155 100644
--- a/lib/ephy-gui.h
+++ b/lib/ephy-gui.h
@@ -32,17 +32,12 @@ void ephy_gui_menu_position_under_widget (GtkMenu *menu,
gboolean *push_in,
gpointer user_data);
-gint ephy_gui_gtk_radio_button_get (GtkRadioButton *radio_button);
-
-void ephy_gui_gtk_radio_button_set (GtkRadioButton *radio_button,
- gint index);
-
gboolean ephy_gui_confirm_overwrite_file (GtkWidget *parent,
const char *filename);
void ephy_gui_help (GtkWindow *parent,
const char *file_name,
- const char *link_id);
+ const char *link_id);
G_END_DECLS
#endif
diff --git a/lib/ephy-string.c b/lib/ephy-string.c
index b97e0485c..79eaa215a 100644
--- a/lib/ephy-string.c
+++ b/lib/ephy-string.c
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -25,9 +25,6 @@
#include <errno.h>
#include <string.h>
#include <glib.h>
-#include <bonobo/bonobo-i18n.h>
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libxml/parser.h>
#define ELLIPSIS "\xe2\x80\xa6"
@@ -40,7 +37,7 @@
* FIXME: this function is a big mess. While it is utf-8 safe now,
* it can still split a sequence of combining characters
*/
-gchar *
+char *
ephy_string_shorten (const gchar *str, gint target_length)
{
gchar *new_str;
@@ -57,91 +54,17 @@ ephy_string_shorten (const gchar *str, gint target_length)
/* create string */
bytes = GPOINTER_TO_UINT (g_utf8_offset_to_pointer (str, target_length - 1) - str);
-
+
new_str = g_new0 (gchar, bytes + strlen(ELLIPSIS) + 1);
-
+
strncpy (new_str, str, bytes);
strncpy (new_str + bytes, ELLIPSIS, strlen (ELLIPSIS));
return new_str;
}
-char *
-ephy_string_double_underscores (const char *string)
-{
- int underscores;
- const char *p;
- char *q;
- char *escaped;
-
- if (string == NULL) {
- return NULL;
- }
-
- underscores = 0;
- for (p = string; *p != '\0'; p++) {
- underscores += (*p == '_');
- }
-
- if (underscores == 0) {
- return g_strdup (string);
- }
-
- escaped = g_new (char, strlen (string) + underscores + 1);
- for (p = string, q = escaped; *p != '\0'; p++, q++) {
- /* Add an extra underscore. */
- if (*p == '_') {
- *q++ = '_';
- }
- *q = *p;
- }
- *q = '\0';
-
- return escaped;
-}
-
-/**
- * ephy_string_store_time_in_string:
- * NOTE: str must be at least 256 chars long
- */
-void
-ephy_string_store_time_in_string (GDate *t, gchar *str, const char *format)
-{
- int length;
-
- if (t > 0)
- {
- /* format into string */
- /* this is used whenever a brief date is needed, like
- * in the history (for last visited, first time visited) */
- length = g_date_strftime (str, 255,
- format ? format : _("%Y-%m-%d"), t);
- str[length] = '\0';
- }
- else
- {
- str[0] = '\0';
- }
-}
-
-/**
- * ephy_string_time_to_string:
- */
-gchar *
-ephy_string_time_to_string (GDate *t,
- const char *format)
-{
- gchar str[256];
-
- /* write into stack string */
- ephy_string_store_time_in_string (t, str, format);
-
- /* copy in heap and return */
- return g_strdup (str);
-}
-
gboolean
-ephy_str_to_int (const char *string, gulong *integer)
+ephy_string_to_int (const char *string, gulong *integer)
{
gulong result;
char *parse_end;
@@ -183,7 +106,7 @@ ephy_str_to_int (const char *string, gulong *integer)
* of @remove_this.
*/
char *
-ephy_str_strip_chr (const char *source, char remove_this)
+ephy_string_strip_chr (const char *source, char remove_this)
{
char *result, *out;
const char *in;
@@ -204,313 +127,17 @@ ephy_str_strip_chr (const char *source, char remove_this)
return result;
}
-int
-ephy_strcasecmp (const char *string_a, const char *string_b)
-{
- return g_ascii_strcasecmp (string_a == NULL ? "" : string_a,
- string_b == NULL ? "" : string_b);
-}
-
-int
-ephy_strcasecmp_compare_func (gconstpointer string_a, gconstpointer string_b)
-{
- return ephy_strcasecmp ((const char *) string_a,
- (const char *) string_b);
-}
-
-/**
- * like strpbrk but ignores chars preceded by slashes, unless the
- * slash is also preceded by a slash unless that later slash is
- * preceded by another slash... ;-)
- */
-static char *
-ephy_strpbrk_unescaped (const char *s, const char *accept)
-{
- gchar *ret = strpbrk (s, accept);
-
- if (!ret || ret == s || *(ret - 1) != '\\')
- {
- return ret;
- }
- else
- {
- gchar *c = ret - 1;
- g_assert (*c == '\\');
-
- while (c >= s && *c == '\\') c--;
-
- if ((ret - c) % 2 == 0)
- {
- return ephy_strpbrk_unescaped (ret + 1, accept);
- }
- else
- {
- return ret;
- }
- }
-}
-
-/**
- * like strstr but supports quoting, ignoring matches inside quoted text
- */
-static char *
-ephy_strstr_with_quotes (const char *haystack, const char *needle,
- const char *quotes)
-{
- gchar *quot = ephy_strpbrk_unescaped (haystack, quotes);
- gchar *ret = strstr (haystack, needle);
-
- if (!quot || !ret || ret < quot)
- {
- return ret;
- }
-
- quot = ephy_strpbrk_unescaped (quot + 1, quotes);
-
- if (quot)
- {
- return ephy_strstr_with_quotes (quot + 1, needle, quotes);
- }
- else
- {
- return NULL;
- }
-}
-
-/**
- * like strpbrk but supports quoting, ignoring matches inside quoted text
- */
-static char *
-ephy_strpbrk_with_quotes (const char *haystack, const char *needles,
- const char *quotes)
-{
- gchar *quot = ephy_strpbrk_unescaped (haystack, quotes);
- gchar *ret = strpbrk (haystack, needles);
-
- if (!quot || !ret || ret < quot)
- {
- return ret;
- }
-
- quot = ephy_strpbrk_unescaped (quot + 1, quotes);
-
- if (quot)
- {
- return ephy_strpbrk_with_quotes (quot + 1, needles, quotes);
- }
- else
- {
- return NULL;
- }
-}
-
-/**
- * Like g_strsplit, but does not split tokens betwen quotes. Ignores
- * quotes preceded by '\'.
- */
-gchar **
-ephy_strsplit_with_quotes (const gchar *string,
- const gchar *delimiter,
- gint max_tokens,
- const gchar *quotes)
-{
- GSList *string_list = NULL, *slist;
- gchar **str_array, *s;
- guint n = 0;
- const gchar *remainder;
-
- g_return_val_if_fail (string != NULL, NULL);
- g_return_val_if_fail (delimiter != NULL, NULL);
- g_return_val_if_fail (delimiter[0] != '\0', NULL);
-
- if (quotes == NULL)
- {
- return g_strsplit (string, delimiter, max_tokens);
- }
-
- if (max_tokens < 1)
- {
- max_tokens = G_MAXINT;
- }
-
- remainder = string;
- s = ephy_strstr_with_quotes (remainder, delimiter, quotes);
- if (s)
- {
- gsize delimiter_len = strlen (delimiter);
-
- while (--max_tokens && s)
- {
- gsize len;
- gchar *new_string;
-
- len = s - remainder;
- new_string = g_new (gchar, len + 1);
- strncpy (new_string, remainder, len);
- new_string[len] = 0;
- string_list = g_slist_prepend (string_list, new_string);
- n++;
- remainder = s + delimiter_len;
- s = ephy_strstr_with_quotes (remainder, delimiter, quotes);
- }
- }
- if (*string)
- {
- n++;
- string_list = g_slist_prepend (string_list, g_strdup (remainder));
- }
-
- str_array = g_new (gchar*, n + 1);
-
- str_array[n--] = NULL;
- for (slist = string_list; slist; slist = slist->next)
- {
- str_array[n--] = slist->data;
- }
-
- g_slist_free (string_list);
-
- return str_array;
-}
-
-/**
- * like ephy_strsplit_with_quotes, but matches any char in 'delimiters' as delimiter
- * and does not return empty tokens
- */
-gchar **
-ephy_strsplit_multiple_delimiters_with_quotes (const gchar *string,
- const gchar *delimiters,
- gint max_tokens,
- const gchar *quotes)
-{
- GSList *string_list = NULL, *slist;
- gchar **str_array, *s;
- guint n = 0;
- const gchar *remainder;
-
- g_return_val_if_fail (string != NULL, NULL);
- g_return_val_if_fail (delimiters != NULL, NULL);
- g_return_val_if_fail (delimiters[0] != '\0', NULL);
-
- if (quotes == NULL)
- {
- quotes = "";
- }
-
- if (max_tokens < 1)
- {
- max_tokens = G_MAXINT;
- }
-
- remainder = string;
- s = ephy_strpbrk_with_quotes (remainder, delimiters, quotes);
- if (s)
- {
- const gsize delimiter_len = 1; /* only chars */
-
- while (--max_tokens && s)
- {
- gsize len;
- gchar *new_string;
-
- len = s - remainder;
- if (len > 0) /* ignore empty strings */
- {
- new_string = g_new (gchar, len + 1);
- strncpy (new_string, remainder, len);
- new_string[len] = 0;
- string_list = g_slist_prepend (string_list, new_string);
- n++;
- }
- remainder = s + delimiter_len;
- s = ephy_strpbrk_with_quotes (remainder, delimiters, quotes);
- }
- }
- if (*string)
- {
- n++;
- string_list = g_slist_prepend (string_list, g_strdup (remainder));
- }
-
- str_array = g_new (gchar*, n + 1);
-
- str_array[n--] = NULL;
- for (slist = string_list; slist; slist = slist->next)
- {
- str_array[n--] = slist->data;
- }
-
- g_slist_free (string_list);
-
- return str_array;
-}
-
-char *
-ephy_str_replace_substring (const char *string,
- const char *substring,
- const char *replacement)
-{
- int substring_length, replacement_length, result_length, remaining_length;
- const char *p, *substring_position;
- char *result, *result_position;
-
- g_return_val_if_fail (substring != NULL, g_strdup (string));
- g_return_val_if_fail (substring[0] != '\0', g_strdup (string));
-
- if (string == NULL)
- {
- return NULL;
- }
-
- substring_length = strlen (substring);
- replacement_length = replacement == NULL ? 0 : strlen (replacement);
-
- result_length = strlen (string);
- for (p = string; ; p = substring_position + substring_length)
- {
- substring_position = strstr (p, substring);
- if (substring_position == NULL)
- {
- break;
- }
- result_length += replacement_length - substring_length;
- }
-
- result = g_malloc (result_length + 1);
-
- result_position = result;
- for (p = string; ; p = substring_position + substring_length)
- {
- substring_position = strstr (p, substring);
- if (substring_position == NULL)
- {
- remaining_length = strlen (p);
- memcpy (result_position, p, remaining_length);
- result_position += remaining_length;
- break;
- }
- memcpy (result_position, p, substring_position - p);
- result_position += substring_position - p;
- memcpy (result_position, replacement, replacement_length);
- result_position += replacement_length;
- }
- g_assert (result_position - result == result_length);
- result_position[0] = '\0';
-
- return result;
-}
-
/* copied from egg-toolbar-editor.c */
-gchar *
-ephy_str_elide_underscores (const gchar *original)
+char *
+ephy_string_elide_underscores (const gchar *original)
{
gchar *q, *result;
const gchar *p;
gboolean last_underscore;
-
+
q = result = g_malloc (strlen (original) + 1);
last_underscore = FALSE;
-
+
for (p = original; *p; p++)
{
if (!last_underscore && *p == '_')
@@ -523,8 +150,8 @@ ephy_str_elide_underscores (const gchar *original)
*q++ = *p;
}
}
-
+
*q = '\0';
-
+
return result;
}
diff --git a/lib/ephy-string.h b/lib/ephy-string.h
index 56dad3552..a7d083457 100644
--- a/lib/ephy-string.h
+++ b/lib/ephy-string.h
@@ -23,45 +23,16 @@
G_BEGIN_DECLS
-char * ephy_string_double_underscores (const char *string);
-
-void ephy_string_store_time_in_string (GDate *t,
- gchar *str,
- const char *format);
-
-gchar *ephy_string_time_to_string (GDate *t,
- const char *format);
-
-gboolean ephy_str_to_int (const char *string,
+gboolean ephy_string_to_int (const char *string,
gulong *integer);
-char *ephy_str_strip_chr (const char *source,
+char *ephy_string_strip_chr (const char *source,
char remove_this);
-int ephy_strcasecmp (const char *string_a,
- const char *string_b);
-
-int ephy_strcasecmp_compare_func (gconstpointer string_a,
- gconstpointer string_b);
-
-char **ephy_strsplit_with_quotes (const gchar *string,
- const gchar *delimiter,
- gint max_tokens,
- const gchar *quotes);
-
-gchar *ephy_string_shorten (const gchar *str,
+char *ephy_string_shorten (const gchar *str,
gint target_length);
-char **ephy_strsplit_multiple_delimiters_with_quotes (const gchar *string,
- const gchar *delimiters,
- gint max_tokens,
- const gchar *quotes);
-
-char *ephy_str_replace_substring (const char *string,
- const char *substring,
- const char *replacement);
-
-gchar *ephy_str_elide_underscores (const gchar *original);
+char *ephy_string_elide_underscores (const gchar *original);
G_END_DECLS
diff --git a/src/ephy-nautilus-view.c b/src/ephy-nautilus-view.c
index 897d67af3..ee0e78cfe 100644
--- a/src/ephy-nautilus-view.c
+++ b/src/ephy-nautilus-view.c
@@ -22,15 +22,14 @@
#include <bonobo/bonobo-zoomable.h>
#include <bonobo/bonobo-ui-util.h>
#include <string.h>
+
#include "ephy-embed-popup-control.h"
#include "ephy-nautilus-view.h"
#include "ephy-embed.h"
#include "ephy-embed-utils.h"
#include "find-dialog.h"
#include "print-dialog.h"
-#include "ephy-prefs.h"
#include "ephy-zoom.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
static void gnv_embed_location_cb (EphyEmbed *embed,
@@ -89,16 +88,16 @@ static void gnv_cmd_edit_find (BonoboUIComponent *uic,
/* popups */
-static EphyNautilusView *gnv_view_from_popup (EphyEmbedPopup *popup);
+static EphyNautilusView *gnv_view_from_popup (EphyEmbedPopupControl*popup);
static void gnv_popup_cmd_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
+ EphyEmbedPopupControl*popup,
const char* verbname);
static void gnv_popup_cmd_image_in_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
+ EphyEmbedPopupControl*popup,
const char* verbname);
static void gnv_popup_cmd_frame_in_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
+ EphyEmbedPopupControl*popup,
const char* verbname);
struct EphyNautilusViewPrivate {
@@ -107,10 +106,6 @@ struct EphyNautilusViewPrivate {
char *location;
int load_percent;
- /*
- BonoboPropertyBag *property_bag;
- */
-
EphyEmbedPopupControl *popup;
BonoboUIComponent *popup_ui;
BonoboControl *control;
@@ -159,59 +154,25 @@ ephy_nautilus_view_instance_init (EphyNautilusView *view)
g_object_ref (G_OBJECT (ephy_shell));
g_signal_connect (view->priv->embed, "ge_link_message",
- GTK_SIGNAL_FUNC (gnv_embed_link_message_cb),
+ G_CALLBACK (gnv_embed_link_message_cb),
view);
g_signal_connect (view->priv->embed, "ge_location",
- GTK_SIGNAL_FUNC (gnv_embed_location_cb),
+ G_CALLBACK (gnv_embed_location_cb),
view);
g_signal_connect (view->priv->embed, "ge_title",
- GTK_SIGNAL_FUNC (gnv_embed_title_cb),
- view);
-/*
- g_signal_connect (view->priv->embed, "ge_js_status",
- GTK_SIGNAL_FUNC (gnv_embed_js_status_cb),
+ G_CALLBACK (gnv_embed_title_cb),
view);
- g_signal_connect (view->priv->embed, "ge_progress",
- GTK_SIGNAL_FUNC (gnv_embed_progress_cb),
- view);
- g_signal_connect (view->priv->embed, "ge_net_state",
- GTK_SIGNAL_FUNC (gnv_embed_net_state_cb),
- view);
-*/
g_signal_connect (view->priv->embed, "ge_new_window",
- GTK_SIGNAL_FUNC (gnv_embed_new_window_cb),
- view);
-/*
- g_signal_connect (view->priv->embed, "ge_visibility",
- GTK_SIGNAL_FUNC (gnv_embed_visibility_cb),
+ G_CALLBACK (gnv_embed_new_window_cb),
view);
- g_signal_connect (view->priv->embed, "ge_destroy_brsr",
- GTK_SIGNAL_FUNC (gnv_embed_destroy_brsr_cb),
- view);
- g_signal_connect (view->priv->embed, "ge_open_uri",
- GTK_SIGNAL_FUNC (gnv_embed_open_uri_cb),
- view);
- g_signal_connect (view->priv->embed, "ge_size_to",
- GTK_SIGNAL_FUNC (gnv_embed_size_to_cb),
- view);
- g_signal_connect (view->priv->embed, "ge_dom_mouse_click",
- GTK_SIGNAL_FUNC (gnv_embed_dom_mouse_click_cb),
- view);
-*/
g_signal_connect (view->priv->embed, "ge_dom_mouse_click",
- GTK_SIGNAL_FUNC (gnv_embed_dom_mouse_click_cb),
+ G_CALLBACK (gnv_embed_dom_mouse_click_cb),
view);
g_signal_connect (view->priv->embed, "ge_context_menu",
- GTK_SIGNAL_FUNC (gnv_embed_context_menu_cb),
- view);
-
-/*
- g_signal_connect (view->priv->embed, "ge_security_change",
- GTK_SIGNAL_FUNC (gnv_embed_security_change_cb),
+ G_CALLBACK (gnv_embed_context_menu_cb),
view);
-*/
g_signal_connect (view->priv->embed, "ge_zoom_change",
- GTK_SIGNAL_FUNC (gnv_embed_zoom_change_cb),
+ G_CALLBACK (gnv_embed_zoom_change_cb),
view);
w = GTK_WIDGET (view->priv->embed);
@@ -276,7 +237,8 @@ ephy_nautilus_view_instance_init (EphyNautilusView *view)
"nautilus-epiphany-view.xml",
"EphyNautilusView", NULL);
p->popup = ephy_embed_popup_control_new (p->control);
- ephy_embed_popup_connect_verbs (EPHY_EMBED_POPUP (p->popup), p->popup_ui);
+ ephy_embed_popup_control_connect_verbs
+ (EPHY_EMBED_POPUP_CONTROL (p->popup), p->popup_ui);
g_object_set_data (G_OBJECT (p->popup), "NautilisView", view);
bonobo_ui_component_add_verb_list_with_data (p->popup_ui, ephy_popup_verbs, p->popup);
@@ -358,8 +320,8 @@ gnv_embed_context_menu_cb (EphyEmbed *embed,
EmbedEventContext context;
ephy_embed_event_get_context (event, &context);
- ephy_embed_popup_set_event (EPHY_EMBED_POPUP (p->popup), event);
- ephy_embed_popup_show (EPHY_EMBED_POPUP (p->popup), embed);
+ ephy_embed_popup_control_set_event (p->popup, event);
+ ephy_embed_popup_control_show (p->popup, embed);
}
static void
@@ -406,15 +368,8 @@ gnv_embed_location_cb (EphyEmbed *embed, EphyNautilusView *view)
nautilus_view_report_location_change (NAUTILUS_VIEW (view), new_uri, NULL, new_uri);
- /* TODO, FIXME
- nautilus_view_report_redirect (view, p->location, new_uri, NULL, new_uri);
- */
-
-
g_free (p->location);
p->location = new_uri;
-
-
}
static void
@@ -490,7 +445,7 @@ gnv_bonobo_control_activate_cb (BonoboControl *control, gboolean state, EphyNaut
}
static EphyNautilusView *
-gnv_view_from_popup (EphyEmbedPopup *popup)
+gnv_view_from_popup (EphyEmbedPopupControl*popup)
{
return g_object_get_data (G_OBJECT (popup), "NautilisView");
}
@@ -498,7 +453,7 @@ gnv_view_from_popup (EphyEmbedPopup *popup)
static void
gnv_popup_cmd_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
+ EphyEmbedPopupControl*popup,
const char* verbname)
{
EphyEmbedEvent *info;
@@ -507,7 +462,7 @@ gnv_popup_cmd_new_window (BonoboUIComponent *uic,
view = gnv_view_from_popup (popup);
- info = ephy_embed_popup_get_event (popup);
+ info = ephy_embed_popup_control_get_event (popup);
ephy_embed_event_get_property (info, "link", &value);
@@ -517,7 +472,7 @@ gnv_popup_cmd_new_window (BonoboUIComponent *uic,
static void
gnv_popup_cmd_image_in_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
+ EphyEmbedPopupControl*popup,
const char* verbname)
{
EphyEmbedEvent *info;
@@ -526,7 +481,7 @@ gnv_popup_cmd_image_in_new_window (BonoboUIComponent *uic,
view = gnv_view_from_popup (popup);
- info = ephy_embed_popup_get_event (popup);
+ info = ephy_embed_popup_control_get_event (popup);
ephy_embed_event_get_property (info, "image", &value);
@@ -536,7 +491,7 @@ gnv_popup_cmd_image_in_new_window (BonoboUIComponent *uic,
static void
gnv_popup_cmd_frame_in_new_window (BonoboUIComponent *uic,
- EphyEmbedPopup *popup,
+ EphyEmbedPopupControl*popup,
const char* verbname)
{
EphyEmbedEvent *info;
@@ -545,7 +500,7 @@ gnv_popup_cmd_frame_in_new_window (BonoboUIComponent *uic,
view = gnv_view_from_popup (popup);
- info = ephy_embed_popup_get_event (popup);
+ info = ephy_embed_popup_control_get_event (popup);
ephy_embed_get_location (view->priv->embed, FALSE, &location);
@@ -583,11 +538,6 @@ gnv_cmd_file_print (BonoboUIComponent *uic,
dialog = print_dialog_new (p->embed, NULL);
- //g_signal_connect (G_OBJECT(dialog),
- // "preview",
- // G_CALLBACK (print_dialog_preview_cb),
- // window);
-
ephy_dialog_set_modal (dialog, TRUE);
ephy_dialog_show (dialog);
@@ -677,284 +627,3 @@ gnv_embed_zoom_change_cb (EphyNautilusView *embed,
bonobo_zoomable_report_zoom_level_changed (view->priv->zoomable,
new_zoom, NULL);
}
-
-
-#ifdef IM_TOO_LAZY_TO_MOVE_THIS_TO_ANOTHER_FILE
-
-
-/* property bag properties */
-enum {
- ICON_NAME,
- COMPONENT_INFO
-};
-
-
-static void
-get_bonobo_properties (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer callback_data)
-{
- EphyNautilusView *content_view;
-
- content_view = (EphyNautilusView*) callback_data;
-
- switch (arg_id) {
- case ICON_NAME:
- if (!strncmp (content_view->priv->uri, "man:", 4)) {
- BONOBO_ARG_SET_STRING (arg, "manual");
- } else if (!strncmp (content_view->priv->uri, "http:", 5)) {
- BONOBO_ARG_SET_STRING (arg, "i-web");
- } else if (!strncmp (content_view->priv->uri, "https:", 6)) {
- /* FIXME: put a nice icon for secure sites */
- BONOBO_ARG_SET_STRING (arg, "i-web");
- } else {
- BONOBO_ARG_SET_STRING (arg, "");
- }
- break;
-
- case COMPONENT_INFO:
- BONOBO_ARG_SET_STRING (arg, "");
- break;
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-
-/* there are no settable properties, so complain if someone tries to set one */
-static void
-set_bonobo_properties (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer callback_data)
-{
- g_warning ("Bad Property set on view: property ID %d",
- arg_id);
-}
-
-static void
-ephy_nautilus_view_initialize (EphyNautilusView *view)
-{
-
-
-#ifdef NOT_PORTED
- bonobo_control_set_properties (nautilus_view_get_bonobo_control (view->priv->nautilus_view),
- view->priv->property_bag);
-#endif
- bonobo_property_bag_add (view->priv->property_bag, "icon_name", ICON_NAME,
- BONOBO_ARG_STRING, NULL,
- _("name of icon for the mozilla view"), 0);
- bonobo_property_bag_add (view->priv->property_bag, "summary_info", COMPONENT_INFO,
- BONOBO_ARG_STRING, NULL,
- _("mozilla summary info"), 0);
-}
-
-
- /* free the property bag */
- if (view->priv->property_bag != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (view->priv->property_bag));
- view->priv->property_bag = NULL;
- }
-
-}
-
-
-
-void
-ephy_nautilus_view_report_load_progress (EphyNautilusView *view,
- double value)
-{
- g_return_if_fail (EPHY_IS_NAUTILUS_VIEW (view));
-
- if (value < 0.0) value = 0.0;
- if (value > 1.0) value = 1.0;
-
- nautilus_view_report_load_progress (view->priv->nautilus_view, value);
-}
-
-/***********************************************************************************/
-
-/**
- * vfs_open_cb
- *
- * Callback for gnome_vfs_async_open. Attempt to read data from handle
- * and pass to mozilla streaming callback.
- *
- **/
-static void
-vfs_open_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer data)
-{
- EphyNautilusView *view = data;
-
- LOG ("+%s GnomeVFSResult: %u", G_GNUC_FUNCTION, (unsigned)result)
-
- if (result != GNOME_VFS_OK)
- {
- gtk_moz_embed_close_stream (GTK_MOZ_EMBED (view->priv->embed->mozembed));
- /* NOTE: the view may go away after a call to report_load_failed */
- LOG (">nautilus_view_report_load_failed")
- nautilus_view_report_load_failed (view->priv->nautilus_view);
- } else {
- if (view->priv->vfs_read_buffer == NULL) {
- view->priv->vfs_read_buffer = g_malloc (VFS_READ_BUFFER_SIZE);
- }
- gtk_moz_embed_open_stream (GTK_MOZ_EMBED (view->priv->embed->mozembed), "file:///", "text/html");
- gnome_vfs_async_read (handle, view->priv->vfs_read_buffer, VFS_READ_BUFFER_SIZE, vfs_read_cb, view);
- }
- LOG ("-%s", G_GNUC_FUNCTION);
-}
-
-/**
- * vfs_read_cb:
- *
- * Read data from buffer and copy into mozilla stream.
- **/
-
-static void
-vfs_read_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, gpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer data)
-{
- EphyNautilusView *view = data;
-
- LOG ("+%s %ld/%ld bytes", G_GNUC_FUNCTION, (long)bytes_requested, (long) bytes_read)
-
- if (bytes_read != 0) {
- gtk_moz_embed_append_data (GTK_MOZ_EMBED (view->priv->embed->mozembed), buffer, bytes_read);
- }
-
- if (bytes_read == 0 || result != GNOME_VFS_OK) {
- gtk_moz_embed_close_stream (GTK_MOZ_EMBED (view->priv->embed->mozembed));
- view->priv->vfs_handle = NULL;
- g_free (view->priv->vfs_read_buffer);
- view->priv->vfs_read_buffer = NULL;
-
- gnome_vfs_async_close (handle, (GnomeVFSAsyncCloseCallback) gtk_true, NULL);
-
- LOG (">nautilus_view_report_load_complete")
- nautilus_view_report_load_complete (view->priv->nautilus_view);
-
- LOG ("=%s load complete", G_GNUC_FUNCTION)
- } else {
- gnome_vfs_async_read (handle, view->priv->vfs_read_buffer, VFS_READ_BUFFER_SIZE, vfs_read_cb, view);
- }
-
- LOG ("-%s", G_GNUC_FUNCTION)
-}
-
-/***********************************************************************************/
-
-static void
-cancel_pending_vfs_operation (EphyNautilusView *view)
-{
- if (view->priv->vfs_handle != NULL) {
- gnome_vfs_async_cancel (view->priv->vfs_handle);
- gtk_moz_embed_close_stream (GTK_MOZ_EMBED (view->priv->embed->mozembed));
- }
-
- view->priv->vfs_handle = NULL;
- g_free (view->priv->vfs_read_buffer);
- view->priv->vfs_read_buffer = NULL;
-}
-
-
-/* this takes a "nautilus" uri, not a "mozilla" uri and uses (sometimes) GnomeVFS */
-static void
-navigate_mozilla_to_nautilus_uri (EphyNautilusView *view,
- const char *uri)
-{
- char *old_uri;
-
- cancel_pending_vfs_operation (view);
-
- if (!GTK_WIDGET_REALIZED (view->priv->embed->mozembed)) {
-
- /* Doing certain things to gtkmozembed before
- * the widget has realized (specifically, opening
- * content streams) can cause crashes. To avoid
- * this, we postpone all navigations
- * until the widget has realized (we believe
- * premature realization may cause other issues)
- */
-
- LOG ("=%s: Postponing navigation request to widget realization", G_GNUC_FUNCTION)
- /* Note that view->priv->uri is still set below */
- } else {
- if (should_mozilla_load_uri_directly (uri)) {
-
- /* See if the current URI is the same as what mozilla already
- * has. If so, issue a reload rather than a load.
- * We ask mozilla for it's uri rather than using view->priv->uri because,
- * from time to time, our understanding of mozilla's URI can become inaccurate
- * (in particular, certain errors may cause embedded mozilla to not change
- * locations)
- */
-
- old_uri = view->priv->embed->location;
-
- if (old_uri != NULL && uris_identical (uri, old_uri)) {
- LOG ("=%s uri's identical, telling ephy to reload", G_GNUC_FUNCTION)
- embed_reload (view->priv->embed,
- GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE);
- } else {
- embed_load_url (view->priv->embed, uri);
- }
-
- } else {
- LOG ("=%s loading URI via gnome-vfs", G_GNUC_FUNCTION)
- gnome_vfs_async_open (&(view->priv->vfs_handle), uri,
- GNOME_VFS_OPEN_READ, GNOME_VFS_PRIORITY_DEFAULT,
- vfs_open_cb, view);
- }
- }
-
- g_free (view->priv->uri);
- view->priv->uri = g_strdup (uri);
-
- LOG ("=%s current URI is now '%s'", G_GNUC_FUNCTION, view->priv->uri)
-}
-
-/*
- * This a list of URI schemes that mozilla should load directly, rather than load through gnome-vfs
- */
-static gboolean
-should_mozilla_load_uri_directly (const char *uri)
-{
- static const char *handled_by_mozilla[] =
- {
- "http",
- "file",
- "toc",
- "man",
- "info",
- "ghelp",
- "gnome-help",
- "https",
- NULL
- };
- gint i;
- gint uri_length;
-
- if (uri == NULL) return FALSE;
-
- uri_length = strlen (uri);
-
- for (i = 0; handled_by_mozilla[i] != NULL; i++)
- {
- const gchar *current = handled_by_mozilla[i];
- gint current_length = strlen (current);
- if ((uri_length >= current_length)
- && (!strncasecmp (uri, current, current_length)))
- return TRUE;
- }
- return FALSE;
-}
-
-
-
-#endif
diff --git a/src/session.c b/src/session.c
index 751fdd186..58b9acae9 100644
--- a/src/session.c
+++ b/src/session.c
@@ -608,16 +608,16 @@ session_load (Session *session,
xmlChar *tmp;
tmp = xmlGetProp (child, "x");
- ephy_str_to_int (tmp, &x);
+ ephy_string_to_int (tmp, &x);
xmlFree (tmp);
tmp = xmlGetProp (child, "y");
- ephy_str_to_int (tmp, &y);
+ ephy_string_to_int (tmp, &y);
xmlFree (tmp);
tmp = xmlGetProp (child, "width");
- ephy_str_to_int (tmp, &width);
+ ephy_string_to_int (tmp, &width);
xmlFree (tmp);
tmp = xmlGetProp (child, "height");
- ephy_str_to_int (tmp, &height);
+ ephy_string_to_int (tmp, &height);
xmlFree (tmp);
window = ephy_window_new ();
diff --git a/src/statusbar.c b/src/statusbar.c
index 50542f9f7..1ea19d57b 100755
--- a/src/statusbar.c
+++ b/src/statusbar.c
@@ -203,8 +203,8 @@ statusbar_set_message (Statusbar *s,
g_return_if_fail (message != NULL);
- tmp1 = ephy_str_strip_chr (message, '\r');
- tmp2 = ephy_str_strip_chr (tmp1, '\n');
+ tmp1 = ephy_string_strip_chr (message, '\r');
+ tmp2 = ephy_string_strip_chr (tmp1, '\n');
gtk_statusbar_pop (GTK_STATUSBAR (s), 0);
gtk_statusbar_push (GTK_STATUSBAR (s), 0, tmp2);
diff --git a/src/toolbar.c b/src/toolbar.c
index a1ca442cb..2896c7341 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -195,7 +195,7 @@ toolbar_ensure_action (Toolbar *t,
{
EphyNode *node;
- if (!ephy_str_to_int (name + strlen ("GoBookmarkId"), &id))
+ if (!ephy_string_to_int (name + strlen ("GoBookmarkId"), &id))
{
return;
}
@@ -218,7 +218,7 @@ toolbar_ensure_action (Toolbar *t,
{
EphyNode *node;
- if (!ephy_str_to_int (name + strlen ("GoTopicId"), &id))
+ if (!ephy_string_to_int (name + strlen ("GoTopicId"), &id))
{
return;
}