aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-03-04 03:54:36 +0800
committerChristian Persch <chpe@src.gnome.org>2004-03-04 03:54:36 +0800
commita65777247b2c4a412ee1972cab884f462dc19276 (patch)
treeb0dce97cad625aaf16e0da55459d178a579b64de
parentade55d6a9658567dcefb18fc0d536a7e3eed0c8c (diff)
downloadgsoc2013-epiphany-a65777247b2c4a412ee1972cab884f462dc19276.tar
gsoc2013-epiphany-a65777247b2c4a412ee1972cab884f462dc19276.tar.gz
gsoc2013-epiphany-a65777247b2c4a412ee1972cab884f462dc19276.tar.bz2
gsoc2013-epiphany-a65777247b2c4a412ee1972cab884f462dc19276.tar.lz
gsoc2013-epiphany-a65777247b2c4a412ee1972cab884f462dc19276.tar.xz
gsoc2013-epiphany-a65777247b2c4a412ee1972cab884f462dc19276.tar.zst
gsoc2013-epiphany-a65777247b2c4a412ee1972cab884f462dc19276.zip
Copy and modify gnome_vfs_uri_list_parse() so that we get a list of string
2004-03-03 Christian Persch <chpe@cvs.gnome.org> * lib/widgets/ephy-node-view.c: (uri_list_parse), (drag_data_received_cb): Copy and modify gnome_vfs_uri_list_parse() so that we get a list of string uris instead of GnomeVFSURIs. Change signature of ::node-dropped accordingly. Fixes bug #120231. * src/bookmarks/ephy-bookmarks-editor.c: (node_dropped_cb): Adapt to the changed ::node-dropped signal signature.
-rw-r--r--ChangeLog13
-rw-r--r--lib/widgets/ephy-node-view.c59
-rw-r--r--lib/widgets/ephy-node-view.h2
-rw-r--r--src/bookmarks/ephy-bookmark-properties.c6
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c7
5 files changed, 73 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 439444667..77f9be9be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2004-03-03 Christian Persch <chpe@cvs.gnome.org>
+ * lib/widgets/ephy-node-view.c: (uri_list_parse),
+ (drag_data_received_cb):
+
+ Copy and modify gnome_vfs_uri_list_parse() so that we get a list
+ of string uris instead of GnomeVFSURIs. Change signature of
+ ::node-dropped accordingly. Fixes bug #120231.
+
+ * src/bookmarks/ephy-bookmarks-editor.c: (node_dropped_cb):
+
+ Adapt to the changed ::node-dropped signal signature.
+
+2004-03-03 Christian Persch <chpe@cvs.gnome.org>
+
* embed/downloader-view.c: (download_dialog_pause_cb),
(download_dialog_abort_cb):
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 6949bb404..f5e35d4b0 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -428,6 +428,58 @@ 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,
@@ -468,15 +520,16 @@ drag_data_received_cb (GtkWidget *widget,
node = get_node_from_path (view, path);
- uris = gnome_vfs_uri_list_parse (selection_data->data);
-
+ uris = uri_list_parse (selection_data->data);
+
if (uris != NULL)
{
/* FIXME fill success */
g_signal_emit (G_OBJECT (view),
ephy_node_view_signals[NODE_DROPPED], 0,
node, uris);
- gnome_vfs_uri_list_free (uris);
+ g_list_foreach (uris, (GFunc) g_free, NULL);
+ g_list_free (uris);
}
view->priv->drop_occurred = FALSE;
diff --git a/lib/widgets/ephy-node-view.h b/lib/widgets/ephy-node-view.h
index 5d82dfbaf..9af56e8a5 100644
--- a/lib/widgets/ephy-node-view.h
+++ b/lib/widgets/ephy-node-view.h
@@ -67,7 +67,7 @@ typedef struct
void (*node_activated) (EphyNodeView *view, EphyNode *node);
void (*node_selected) (EphyNodeView *view, EphyNode *node);
- void (*node_dropped) (EphyNodeView *view, EphyNode *node, GList *nodes);
+ void (*node_dropped) (EphyNodeView *view, EphyNode *node, GList *uris);
void (*show_popup) (EphyNodeView *view);
} EphyNodeViewClass;
diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c
index 8201a94f8..f9fac1413 100644
--- a/src/bookmarks/ephy-bookmark-properties.c
+++ b/src/bookmarks/ephy-bookmark-properties.c
@@ -242,13 +242,9 @@ title_entry_changed_cb (GtkWidget *entry, EphyBookmarkProperties *props)
static void
location_entry_changed_cb (GtkWidget *entry, EphyBookmarkProperties *props)
{
- char *text;
-
- text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
ephy_bookmarks_set_address (props->priv->bookmarks,
props->priv->bookmark,
- text);
- g_free (text);
+ gtk_entry_get_text (GTK_ENTRY (entry)));
}
static void
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 42b671a04..732467a0a 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1259,15 +1259,12 @@ node_dropped_cb (EphyNodeView *view, EphyNode *node,
for (l = nodes; l != NULL; l = l->next)
{
- GnomeVFSURI *uri = l->data;
- char *url;
+ const char *url = (const char *) l->data;
EphyNode *bmk;
- url = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
bmk = ephy_bookmarks_find_bookmark (editor->priv->bookmarks, url);
- g_free (url);
- if (bmk)
+ if (bmk != NULL)
{
ephy_bookmarks_set_keyword (editor->priv->bookmarks, node, bmk);
}