Drag an URL from mozilla location bar, drop on a Ruby program?

Is it possible to drag an URL from the mozilla location bar and drop it
on a Ruby program for further processing?

I am using XFree86, I can probably draw an empty window with RubyGTK or
something, but is it possible to process data that is dragged from
another application (like Mozilla)?

TIA,

Erik.

Hi,

···

On Wed, 21 Apr 2004 21:04:06 +0900 Erik Terpstra erik@terpnet.nl wrote:

Is it possible to drag an URL from the mozilla location bar and drop it
on a Ruby program for further processing?

I am using XFree86, I can probably draw an empty window with RubyGTK or
something, but is it possible to process data that is dragged from
another application (like Mozilla)?

Here is a sample for Ruby/GTK2.


require ‘gtk2’

Gtk.init

label = Gtk::Label.new(“Drop Here”)
Gtk::Drag.dest_set(label, Gtk::Drag::DEST_DEFAULT_ALL,
[[“text/plain”, 0, 0]],
Gdk::DragContext::ACTION_COPY| Gdk::DragContext::ACTION_MOVE)

label.signal_connect(“drag_data_received”) do |w, context, x, y, data, info, time|
p data.data #You can get the URL from mozilla.
Gtk::Drag.finish(context, true, false, 0)
end

Gtk::Window.new.add(label).set_default_size(100, 100).show_all

Gtk.main


.:% Masao Mutohmutoh@highway.ne.jp

Cool, thanks a lot!

Masao Mutoh wrote:

···

Here is a sample for Ruby/GTK2.


require ‘gtk2’

Gtk.init

label = Gtk::Label.new(“Drop Here”)
Gtk::Drag.dest_set(label, Gtk::Drag::DEST_DEFAULT_ALL,
[[“text/plain”, 0, 0]],
Gdk::DragContext::ACTION_COPY| Gdk::DragContext::ACTION_MOVE)

label.signal_connect(“drag_data_received”) do |w, context, x, y, data, info, time|
p data.data #You can get the URL from mozilla.
Gtk::Drag.finish(context, true, false, 0)
end

Gtk::Window.new.add(label).set_default_size(100, 100).show_all

Gtk.main