GtkBinding: this seems a hack to me

Hi all!
  I have registered in a widget of mine a signal of type action to be
activated by a key binding. I declared a gboolean return type for my
signal, but now I realize this was a mistake: in gtkbinding.c the
boolean return value for signals is handled in a special way, which
causes the gtk_binding_entry_activate not to return TRUE even if the
signal has been handled correctly.
This is the piece of code (gtkbinding.c):

if (query.return_type == G_TYPE_BOOLEAN)
    g_value_init (&return_val, G_TYPE_BOOLEAN);
g_signal_emitv (params, signal_id, 0, &return_val);

if (query.return_type == G_TYPE_BOOLEAN)
  if (g_value_get_boolean (&return_val))
    handled = TRUE;
  g_value_unset (&return_val);
    handled = TRUE;

I guess this behaviour is needed by some other widgets, but it seems
quite wrong to me: the "handled" variable should be set to TRUE no
matter what the signal returns, since my signal's boolean return value
has nothing to do with this.

By now, I'll workaround this behaviour by setting my signal handler to
return an integer value rather than a boolean, so that this won't be
misinterpretated by gtkbinding.c; but please consider this issue,
whether this special handling is really needed.


Chiacchiera con i tuoi amici in tempo reale!* 

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