[Xfce4-commits] <postler:master> Drop files in composer web view or attachment area
Christian Dywan
noreply at xfce.org
Sat Jan 15 04:20:01 CET 2011
Updating branch refs/heads/master
to c3c1af6622c51ccd94631d77ce126d535d1ecc1b (commit)
from 7e2d4628292f054cfd5a35b38056d80fa3924dd4 (commit)
commit c3c1af6622c51ccd94631d77ce126d535d1ecc1b
Author: Christian Dywan <christian at twotoasts.de>
Date: Sat Jan 15 03:58:41 2011 +0100
Drop files in composer web view or attachment area
Fixes: https://bugs.launchpad.net/postler/+bug/684542
postler/postler-composer.vala | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 6dcb716..58477ce 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -331,6 +331,21 @@ public class Postler.Composer : Gtk.Window {
att_view.visible = false;
}
+ void drag_received (Gdk.DragContext context, int x, int y,
+ Gtk.SelectionData data, uint info, uint timestamp) {
+
+ bool success = false;
+ foreach (string uri in data.get_uris ()) {
+ File file = File.new_for_uri (uri);
+ if (file.query_file_type (FileQueryInfoFlags.NOFOLLOW_SYMLINKS)
+ == FileType.REGULAR && file.is_native ()) {
+ insert_attachment (file.get_path ());
+ success = true;
+ }
+ }
+ Gtk.drag_finish (context, success, false, timestamp);
+ }
+
void action_emoticons (Gtk.Action action) {
var menu = ui.get_widget ("/emoticons") as Gtk.Menu;
if (menu.get_attach_widget () == null) {
@@ -539,6 +554,13 @@ public class Postler.Composer : Gtk.Window {
shelf.pack_start (att_view, true, true, 0);
shelf.show_all ();
+ Gtk.drag_dest_set (content, Gtk.DestDefaults.ALL, {}, Gdk.DragAction.COPY);
+ Gtk.drag_dest_add_uri_targets (content);
+ content.drag_data_received.connect (drag_received);
+ Gtk.drag_dest_set (att_view, Gtk.DestDefaults.ALL, {}, Gdk.DragAction.COPY);
+ Gtk.drag_dest_add_uri_targets (att_view);
+ att_view.drag_data_received.connect (drag_received);
+
actions.get_action ("MessageSend").sensitive = false;
entry_to.notify["text"].connect ((object, pspec) => {
bool state = entry_to.text.strip ().chr (-1, '@') != null;
More information about the Xfce4-commits
mailing list