Re: GTK_RUN_ACTION flag. What is it?




Michael Lausch <mla@gams.co.at> writes:

> What's the meaning of the GTK_RUN_ACTION flag when defining signals?

The flag means that the signal is suitable for being
used in a binding definition in an RC file.

As an example, the "move_current" signal for menu shells
is defined that way, 

  menu_shell_signals[MOVE_CURRENT] =
    gtk_signal_new ("move_current",
		    GTK_RUN_LAST | GTK_RUN_ACTION,
		    object_class->type,
                    GTK_SIGNAL_OFFSET (GtkMenuShellClass, move_current),
		    gtk_marshal_NONE__ENUM,
		    GTK_TYPE_NONE, 1, 
		    GTK_TYPE_MENU_DIRECTION_TYPE);

so you can do, in a RC file:

====
class "GtkCList" binding "clist-test"

binding "menu-test"
{
  bind "<Control>p" {
    "move-current" (prev)
  }
  bind "<Control>n" {
    "move-current" (next)
  }
  bind "<Control>f" {
    "move-current" (child)
  }
  bind "<Control>b" {
    "move-current" (parent)
  }
}
====

And suddenly you have emacs bindings in your menus.
(Unfortunately, you can't rebind the keybindings in
entries and text fields this way yet...)

Without the RUN_ACTION flag, GTK+ would complain
and not allow this. 

Regards,
                                        Owen





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