Q:

how can i get file dropped to which gtkmm image widget

....
std::vector<Gtk::TargetEntry> listTargets;
listTargets.push_back( Gtk::TargetEntry("STRING") );
listTargets.push_back( Gtk::TargetEntry("text/plain") );

image1->drag_dest_set(listTargets);
image1->signal_drag_data_received().connect(sigc::mem_fun(*this,
              &mainWindow::drop_event) );

image2->drag_dest_set(listTargets);
image2->signal_drag_data_received().connect(sigc::mem_fun(*this,
                  &mainWindow::drop_event) );
....

and my drop&drop event handler function :
void mainWindow::drop_event(
        const Glib::RefPtr<Gdk::DragContext>& context, int, int,
        const Gtk::SelectionData& selection_data, guint, guint time)
{
    std::cout << selection_data.get_data_as_string()  << std::endl;
}

I can get file locations that "dragged to image widgets" with this code. output is like this:
file:////opt/google/chrome/google-chrome.desktop
file:////var/www/index.html
file:///opt/libreoffice4.1/LICENSE.html

it's ok, i can. But, how can i get: file dropped to which image (image1 or image2 widgets) like this:
dropped to **image1** : file:////opt/google/chrome/google-chrome.desktop
dropped to **image2** : file:////var/www/index.html
dropped to **image1** : file:///opt/libreoffice4.1/LICENSE.html

thanks...

A:

sigc allows you to bind extra arguments to your handlers.
Hander becomes:
void mainWindow::drop_event(
        const Glib::RefPtr<Gdk::DragContext>& context, int, int,
        const Gtk::SelectionData& selection_data, guint, guint time, 
        Glib::ustring whichImage)
{
    std::cout << "dropped to" << whichImage << ":" << selection_data.get_data_as_string()  << std::endl;
}

And the connect then is:
image1->signal_drag_data_received().connect(sigc::bind<Glib::ustring>(sigc::mem_fun(*this,
              &mainWindow::drop_event), "image1" ));

image2->signal_drag_data_received().connect( sigc::bind<Glib::ustring>(sigc::mem_fun(*this,
                  &mainWindow::drop_event), "image2"));

