aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-07-17 21:20:10 +0800
committerXan Lopez <xan@src.gnome.org>2003-07-17 21:20:10 +0800
commite8fbf999bcd5cc7bb8bf4e2b25885869a744ca43 (patch)
treed71c8ae37d29a5c2235e97bbb49872b02d6b8962 /src
parent3212871bff4999162a67e32c86990821e8c995ed (diff)
downloadgsoc2013-epiphany-e8fbf999bcd5cc7bb8bf4e2b25885869a744ca43.tar
gsoc2013-epiphany-e8fbf999bcd5cc7bb8bf4e2b25885869a744ca43.tar.gz
gsoc2013-epiphany-e8fbf999bcd5cc7bb8bf4e2b25885869a744ca43.tar.bz2
gsoc2013-epiphany-e8fbf999bcd5cc7bb8bf4e2b25885869a744ca43.tar.lz
gsoc2013-epiphany-e8fbf999bcd5cc7bb8bf4e2b25885869a744ca43.tar.xz
gsoc2013-epiphany-e8fbf999bcd5cc7bb8bf4e2b25885869a744ca43.tar.zst
gsoc2013-epiphany-e8fbf999bcd5cc7bb8bf4e2b25885869a744ca43.zip
Allow DND of URLs (from links or favicons or other apps...) to the
Allow DND of URLs (from links or favicons or other apps...) to the bookmarks toolbar, fixes #116613 (HOORAY), thanks to marco and chpe for the help.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-favicon-action.c8
-rw-r--r--src/ephy-tab.c8
-rwxr-xr-xsrc/ephy-toolbars-model.c45
-rwxr-xr-xsrc/toolbar.c3
4 files changed, 58 insertions, 6 deletions
diff --git a/src/ephy-favicon-action.c b/src/ephy-favicon-action.c
index 418c11ab8..376794cba 100644
--- a/src/ephy-favicon-action.c
+++ b/src/ephy-favicon-action.c
@@ -84,7 +84,9 @@ static void
each_url_get_data_binder (EphyDragEachSelectedItemDataGet iteratee,
gpointer iterator_context, gpointer data)
{
+ const char *title;
char *location;
+ char *netscape_url;
EphyTab *tab;
EphyEmbed *embed;
EphyWindow *window = EPHY_WINDOW(iterator_context);
@@ -92,9 +94,13 @@ each_url_get_data_binder (EphyDragEachSelectedItemDataGet iteratee,
tab = ephy_window_get_active_tab (window);
embed = ephy_tab_get_embed (tab);
ephy_embed_get_location (embed, TRUE, &location);
+ title = ephy_tab_get_title (tab);
- iteratee (location, -1, -1, -1, -1, data);
+ netscape_url = g_strconcat (location, "\n", title, NULL);
+ iteratee (netscape_url, -1, -1, -1, -1, data);
+
+ g_free (netscape_url);
g_free (location);
}
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 5d2056dcd..270fd6cb3 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#ifdef HAVE_CONFIG_H
@@ -136,8 +138,8 @@ ephy_tab_get_type (void)
};
ephy_tab_type = g_type_register_static (G_TYPE_OBJECT,
- "EphyTab",
- &our_info, 0);
+ "EphyTab",
+ &our_info, 0);
}
return ephy_tab_type;
@@ -820,7 +822,7 @@ ephy_tab_destroy_brsr_cb (EphyEmbed *embed, EphyTab *tab)
static gint
ephy_tab_open_uri_cb (EphyEmbed *embed, const char *uri,
- EphyTab *tab)
+ EphyTab *tab)
{
LOG ("ephy_tab_open_uri_cb %s", uri)
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c
index e8e733647..e587fde84 100755
--- a/src/ephy-toolbars-model.c
+++ b/src/ephy-toolbars-model.c
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#include "ephy-toolbars-model.h"
@@ -32,8 +34,8 @@ static void ephy_toolbars_model_finalize (GObject *object);
enum
{
- ACTION_ADDED,
- LAST_SIGNAL
+ ACTION_ADDED,
+ LAST_SIGNAL
};
enum
@@ -42,6 +44,12 @@ enum
PROP_BOOKMARKS
};
+enum
+{
+ URL,
+ NAME
+};
+
static GObjectClass *parent_class = NULL;
struct EphyToolbarsModelPrivate
@@ -148,6 +156,39 @@ impl_add_item (EggToolbarsModel *t,
(EPHY_TOOLBARS_MODEL (t), FALSE, id);
g_list_free (nodes);
}
+ else if (gdk_atom_intern (EPHY_DND_URL_TYPE, FALSE) == type)
+ {
+ EphyNode *node = NULL;
+ EphyBookmarks *bookmarks;
+ gchar **netscape_url;
+
+ netscape_url = g_strsplit (name, "\n", 2);
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ node = ephy_bookmarks_find_bookmark (bookmarks, netscape_url[URL]);
+
+ if (!node)
+ {
+ /* Create the bookmark, it does not exist */
+ EphyHistory *gh;
+ const char *icon;
+
+ node = ephy_bookmarks_add (bookmarks, netscape_url[NAME], netscape_url[URL]);
+ g_return_val_if_fail (node != NULL, NULL);
+
+ gh = ephy_embed_shell_get_global_history (EPHY_EMBED_SHELL (ephy_shell));
+ icon = ephy_history_get_icon (gh, netscape_url[URL]);
+
+ if (icon)
+ {
+ ephy_bookmarks_set_icon (bookmarks, netscape_url[URL], icon);
+ }
+ }
+
+ id = ephy_node_get_id (node);
+ action_name = ephy_toolbars_model_get_action_name
+ (EPHY_TOOLBARS_MODEL (t), FALSE, id);
+ g_strfreev (netscape_url);
+ }
else
{
normal_item = TRUE;
diff --git a/src/toolbar.c b/src/toolbar.c
index 3d482f267..2c5fe6a51 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -15,6 +15,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#ifdef HAVE_CONFIG_H
@@ -66,6 +68,7 @@ static GtkTargetEntry drag_targets[] = {
{ EGG_TOOLBAR_ITEM_TYPE, 0, 0 },
{ EPHY_DND_TOPIC_TYPE, 0, 1 },
{ EPHY_DND_BOOKMARK_TYPE, 0, 2 },
+ { EPHY_DND_URL_TYPE, 0, 3 },
};
static int n_drag_targets = G_N_ELEMENTS (drag_targets);