Re: GtkTextView "drag_data_received" handler



Thanks, I had thought of deriving a class but it seems like a bit much for a simple task. Can't believe I didn't think of g_signal_stop_emission_by_name. Much appreciated.

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com


Mathias Hasselmann wrote:
Am Freitag, den 04.01.2008, 16:14 -0800 schrieb Micah Carrick:
  
The GtkTextView has it's own handler for the "drag_data_received". I 
don't see any property or way to squash this handler. Am I missing 
something?
    

GtkTextView just installs a default handler. Those are called after all
custom signal handlers installed with g_signal_connect() (and before any
signal handler installed with g_signal_connect_after()).

Therefore you can connect your own signal handler, which stops signal
emission:

static void
drag_data_received_cb (GtkWidget *widget)
{
  g_signal_stop_emission_by_name (widget, "drag-data-received");
}

Alternatively it should work to derive your own class from GtkTextView
which overrides drag_data_received(), but doesn't call it's parent
class' variant of that method:

static void
maman_bar_drag_data_received (GtkWidget        *widget,
                              GdkDragContext   *context,
                              gint              x,
                              gint              y,
                              GtkSelectionData *data,
                              guint             info,
                              guint             time)
{
}

static void
maman_bar_class_init (MamanBarClass *cls)
{
  GtkWidgetClass *wcls = GTK_WIDGET_CLASS (cls);
  wcls->drag_data_received = maman_bar_drag_data_received;
}


Ciao,
Mathias
  


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]