Drop files or URLs onto tab labels
Fixes: https://bugs.launchpad.net/midori/+bug/735769
This commit is contained in:
parent
a9a5b38c29
commit
6721c0592d
1 changed files with 33 additions and 0 deletions
|
@ -4704,6 +4704,32 @@ midori_view_get_label_ellipsize (MidoriView* view)
|
||||||
return PANGO_ELLIPSIZE_END;
|
return PANGO_ELLIPSIZE_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void midori_view_tab_label_data_received (GtkWidget* widget,
|
||||||
|
GdkDragContext* context,
|
||||||
|
gint x,
|
||||||
|
gint y,
|
||||||
|
GtkSelectionData* data,
|
||||||
|
guint ttype,
|
||||||
|
guint timestamp,
|
||||||
|
MidoriView* view)
|
||||||
|
{
|
||||||
|
gchar **uri;
|
||||||
|
gchar* text;
|
||||||
|
|
||||||
|
uri = gtk_selection_data_get_uris (data);
|
||||||
|
if (uri != NULL)
|
||||||
|
{
|
||||||
|
midori_view_set_uri (view, uri[0]);
|
||||||
|
g_strfreev (uri);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text = gtk_selection_data_get_text (data);
|
||||||
|
midori_view_set_uri (view, text);
|
||||||
|
g_free (text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midori_view_get_proxy_tab_label:
|
* midori_view_get_proxy_tab_label:
|
||||||
* @view: a #MidoriView
|
* @view: a #MidoriView
|
||||||
|
@ -4796,6 +4822,13 @@ midori_view_get_proxy_tab_label (MidoriView* view)
|
||||||
g_signal_connect (view->tab_label, "parent-set",
|
g_signal_connect (view->tab_label, "parent-set",
|
||||||
G_CALLBACK (midori_view_tab_label_parent_set),
|
G_CALLBACK (midori_view_tab_label_parent_set),
|
||||||
view);
|
view);
|
||||||
|
gtk_drag_dest_set (view->tab_label, GTK_DEST_DEFAULT_ALL, NULL,
|
||||||
|
0, GDK_ACTION_COPY);
|
||||||
|
gtk_drag_dest_add_text_targets (view->tab_label);
|
||||||
|
gtk_drag_dest_add_uri_targets (view->tab_label);
|
||||||
|
g_signal_connect (view->tab_label, "drag-data-received",
|
||||||
|
G_CALLBACK (midori_view_tab_label_data_received),
|
||||||
|
view);
|
||||||
}
|
}
|
||||||
return view->tab_label;
|
return view->tab_label;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue