diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-30 21:53:39 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-30 21:53:39 +0800 |
commit | bd2108eb559d0538b59c6907b89f7aba137431dd (patch) | |
tree | 5a35409492af0c228f90a2e524a6db804c579992 /lib/ephy-dnd.c | |
parent | c1008f8781b7940bb7096bc6e5fe250ec6ebcaf2 (diff) | |
download | gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.gz gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.bz2 gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.lz gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.xz gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.tar.zst gsoc2013-epiphany-bd2108eb559d0538b59c6907b89f7aba137431dd.zip |
Allow to drag also normal urls in the toolbars. Commit some fixes I did to
2003-01-30 Marco Pesenti Gritti <marco@it.gnome.org>
* data/ui/epiphany-toolbar.xml.in:
* embed/mozilla/EphyWrapper.cpp:
* embed/mozilla/Makefile.am:
* lib/egg/egg-action.c: (disconnect_proxy):
* lib/egg/egg-menu-merge.c: (update_node):
* lib/ephy-dnd.c: (ephy_dnd_uri_list_extract_uris):
* lib/ephy-dnd.h:
* lib/ephy-string.c: (ephy_str_to_int):
* lib/widgets/ephy-editable-toolbar.c: (item_node_new),
(impl_get_action), (add_action), (parse_item_list),
(toolbar_list_to_xml), (ephy_editable_toolbar_save), (do_merge),
(free_node), (ephy_editable_toolbar_finalize):
* src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_get_bookmark_id):
* src/bookmarks/ephy-new-bookmark.c: (ephy_new_bookmark_add),
(ephy_new_bookmark_response_cb), (ephy_new_bookmark_init),
(ephy_new_bookmark_set_icon), (ephy_new_bookmark_get_id):
* src/bookmarks/ephy-new-bookmark.h:
* src/popup-commands.c: (popup_cmd_add_link_bookmark):
* src/toolbar.c: (get_bookmark_action), (toolbar_get_action):
* src/window-commands.c: (window_cmd_file_add_bookmark):
Allow to drag also normal urls in the toolbars.
Commit some fixes I did to the eggmenu stuff, now
toolbar editor should work well, please start
reporting bugs :)
Diffstat (limited to 'lib/ephy-dnd.c')
-rw-r--r-- | lib/ephy-dnd.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/ephy-dnd.c b/lib/ephy-dnd.c index 03fa83544..99438495c 100644 --- a/lib/ephy-dnd.c +++ b/lib/ephy-dnd.c @@ -20,6 +20,7 @@ #include <gtk/gtkselection.h> #include <gtk/gtktreeview.h> +#include <string.h> static GtkTargetEntry url_drag_types [] = { @@ -108,3 +109,52 @@ ephy_dnd_enable_model_drag_source (GtkWidget *treeview) GDK_ACTION_COPY); } +GList * +ephy_dnd_uri_list_extract_uris (const char *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'; + + result = g_list_prepend (result, retval); + } + } + p = strchr (p, '\n'); + if (p != NULL) + p++; + } + + return g_list_reverse (result); +} |