[Geany-devel] [PATCH 19/19] Use per document indent sizes

Erik de Castro Lopo mle+tools at xxxxx
Tue Aug 10 00:41:35 UTC 2010


Lex Trotman wrote:

> While this works fine and the handlers are only one line each, another
> way would have been to use one handler and set different user_data for
> each menu item.

To be explicit, you can do:

   g_signal_connect ((gpointer) indent_width_1, "activate",
                    G_CALLBACK (on_indent_width_activate),
                    GUINT_TO_POINTER (1));

   g_signal_connect ((gpointer) indent_width_2, "activate",
                    G_CALLBACK (on_indent_width_activate),
                    GUINT_TO_POINTER (2));


and in the on_indent_width_activate() callback use

   GPOINTER_TO_INT(user_data)

to get the int back.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/



More information about the Devel mailing list