aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-toolbars-model.c
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/ephy-toolbars-model.c
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/ephy-toolbars-model.c')
-rwxr-xr-xsrc/ephy-toolbars-model.c45
1 files changed, 43 insertions, 2 deletions
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;