/*
 * call-seq:
 *      attach_to(widget)
 *
 * widget = The widget (or a Gtk::StatusIcon, when compiled against GTK+ >= 2.9.2 and libnotify >= 0.4.1) to attach to
 *
 * Attaches the notification to a Gtk::Widget or Gtk::StatusIcon
 */
static VALUE
_wrap_notification_attach_to(VALUE self, VALUE widget)
{
  GObject *obj = G_OBJECT(RVAL2GOBJ(widget));
  NotifyNotification *n = NOTIFY_NOTIFICATION(RVAL2GOBJ(self));

#ifdef DEBUG
  if(NOTIFY_IS_NOTIFICATION(n))
    rb_warn("attach_to, ok");
  else
    rb_warn("attach_to, no ok");
#endif

#ifdef HAVE_STATUS_ICON
  if(GTK_IS_STATUS_ICON(obj))
    notify_notification_attach_to_status_icon(n, GTK_STATUS_ICON(obj));
  else
    notify_notification_attach_to_widget(n, GTK_WIDGET(obj));
#else
  notify_notification_attach_to_widget(n, GTK_WIDGET(obj));
#endif

  return Qnil;
}