aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-08-06 22:34:43 +0800
committerChristian Persch <chpe@src.gnome.org>2004-08-06 22:34:43 +0800
commit54f1919cae74d3551c23eef9d00975344d1c78a9 (patch)
tree817546aea8161746bcf5f1eb4aabfec0d4d0ec18 /lib
parent394409d0ccca365dd8d9e8a29752d2fb27cb7bbe (diff)
downloadgsoc2013-epiphany-54f1919cae74d3551c23eef9d00975344d1c78a9.tar
gsoc2013-epiphany-54f1919cae74d3551c23eef9d00975344d1c78a9.tar.gz
gsoc2013-epiphany-54f1919cae74d3551c23eef9d00975344d1c78a9.tar.bz2
gsoc2013-epiphany-54f1919cae74d3551c23eef9d00975344d1c78a9.tar.lz
gsoc2013-epiphany-54f1919cae74d3551c23eef9d00975344d1c78a9.tar.xz
gsoc2013-epiphany-54f1919cae74d3551c23eef9d00975344d1c78a9.tar.zst
gsoc2013-epiphany-54f1919cae74d3551c23eef9d00975344d1c78a9.zip
Fix dragging of urls which gnome-vfs can't handle. Fix new tab positioning
2004-08-06 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-string.c: (ephy_string_parse_uri_list): * lib/ephy-string.h: * lib/widgets/ephy-node-view.c: (drag_data_received_cb), (ephy_node_view_class_init): * src/bookmarks/ephy-bookmarks-editor.c: * src/ephy-notebook.c: (notebook_drag_data_received_cb): * src/ephy-notebook.h: * src/ephy-session.c: * src/ephy-shell.c: (ephy_shell_new_tab): * src/ephy-tab.c: (ephy_tab_new_window_cb): * src/ephy-window.c: (ephy_window_load_in_tabs): Fix dragging of urls which gnome-vfs can't handle. Fix new tab positioning when opening tabs from drags.
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-string.c52
-rw-r--r--lib/ephy-string.h2
-rw-r--r--lib/widgets/ephy-node-view.c57
3 files changed, 56 insertions, 55 deletions
diff --git a/lib/ephy-string.c b/lib/ephy-string.c
index dbda76275..daeac7d2b 100644
--- a/lib/ephy-string.c
+++ b/lib/ephy-string.c
@@ -191,3 +191,55 @@ ephy_string_double_underscores (const char *string)
return escaped;
}
+
+/* taken from libgnomevfs/gnome-vfs-uri.c */
+GList*
+ephy_string_parse_uri_list (const gchar* uri_list)
+{
+ /* Note that this is mostly very stolen from old libgnome/gnome-mime.c */
+
+ const gchar *p, *q;
+ gchar *retval;
+ GList *result = NULL;
+
+ g_return_val_if_fail (uri_list != NULL, NULL);
+
+ p = uri_list;
+
+ /* We don't actually try to validate the URI according to RFC
+ * 2396, or even check for allowed characters - we just ignore
+ * comments and trim whitespace off the ends. We also
+ * allow LF delimination as well as the specified CRLF.
+ */
+ while (p != NULL) {
+ if (*p != '#') {
+ while (g_ascii_isspace (*p))
+ p++;
+
+ q = p;
+ while ((*q != '\0')
+ && (*q != '\n')
+ && (*q != '\r'))
+ q++;
+
+ if (q > p) {
+ q--;
+ while (q > p
+ && g_ascii_isspace (*q))
+ q--;
+
+ retval = g_malloc (q - p + 2);
+ strncpy (retval, p, q - p + 1);
+ retval[q - p + 1] = '\0';
+
+ if (retval[0] != '\0')
+ result = g_list_prepend (result, retval);
+ }
+ }
+ p = strchr (p, '\n');
+ if (p != NULL)
+ p++;
+ }
+
+ return g_list_reverse (result);
+}
diff --git a/lib/ephy-string.h b/lib/ephy-string.h
index f2907219f..bc844c09b 100644
--- a/lib/ephy-string.h
+++ b/lib/ephy-string.h
@@ -37,6 +37,8 @@ char *ephy_string_elide_underscores (const char *original);
char *ephy_string_double_underscores (const char *string);
+GList *ephy_string_parse_uri_list (const char *uri_list);
+
G_END_DECLS
#endif
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 3681fe169..9b0f4a5d4 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -30,7 +30,6 @@
#include <gtk/gtktreemodelfilter.h>
#include <gtk/gtkwindow.h>
#include <gdk/gdkkeysyms.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
#include "ephy-node-view.h"
#include "ephy-tree-model-sort.h"
@@ -38,6 +37,7 @@
#include "ephy-dnd.h"
#include "ephy-gui.h"
#include "ephy-marshal.h"
+#include "ephy-string.h"
#include "string.h"
static void ephy_node_view_class_init (EphyNodeViewClass *klass);
@@ -360,58 +360,6 @@ drag_leave_cb (GtkWidget *widget,
remove_scroll_timeout (view);
}
-/* taken from libgnomevfs/gnome-vfs-uri.c */
-static GList*
-uri_list_parse (const gchar* uri_list)
-{
- /* Note that this is mostly very stolen from old libgnome/gnome-mime.c */
-
- const gchar *p, *q;
- gchar *retval;
- GList *result = NULL;
-
- g_return_val_if_fail (uri_list != NULL, NULL);
-
- p = uri_list;
-
- /* We don't actually try to validate the URI according to RFC
- * 2396, or even check for allowed characters - we just ignore
- * comments and trim whitespace off the ends. We also
- * allow LF delimination as well as the specified CRLF.
- */
- while (p != NULL) {
- if (*p != '#') {
- while (g_ascii_isspace (*p))
- p++;
-
- q = p;
- while ((*q != '\0')
- && (*q != '\n')
- && (*q != '\r'))
- q++;
-
- if (q > p) {
- q--;
- while (q > p
- && g_ascii_isspace (*q))
- q--;
-
- retval = g_malloc (q - p + 2);
- strncpy (retval, p, q - p + 1);
- retval[q - p + 1] = '\0';
-
- if (retval[0] != '\0')
- result = g_list_prepend (result, retval);
- }
- }
- p = strchr (p, '\n');
- if (p != NULL)
- p++;
- }
-
- return g_list_reverse (result);
-}
-
static void
drag_data_received_cb (GtkWidget *widget,
GdkDragContext *context,
@@ -452,7 +400,7 @@ drag_data_received_cb (GtkWidget *widget,
node = get_node_from_path (view, path);
- uris = uri_list_parse (selection_data->data);
+ uris = ephy_string_parse_uri_list (selection_data->data);
if (uris != NULL)
{
@@ -1716,4 +1664,3 @@ ephy_node_view_class_init (EphyNodeViewClass *klass)
g_type_class_add_private (object_class, sizeof (EphyNodeViewPrivate));
}
-