Re: connecting to update signal in uimanager

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

 



Yes, this helps.

Thanks!

- Jordan

On Wed, Jul 1, 2009 at 12:41 AM, Martin Nordholts <enselic@xxxxxxxxx> wrote:
On 07/01/2009 12:08 AM, Jordan Stinson wrote:
> static void
> toolbox_create_commands (GimpToolbox *toolbox,
>                                                GimpContext *context)
> {
>     GimpUIManager *ui_manager = GIMP_IMAGE_DOCK (toolbox)->ui_manager;
>     ...
>    g_signal_connect (G_OBJECT (ui_manager), "update", G_CALLBACK
> (toolbox_refresh_commands),
>                 (gpointer) toolbox);
> }
>
> /*Callback function*/
> static void
> toolbox_refresh_commands (GimpUIManager *ui_manager, gpointer data)
> {
>     GimpToolbox *toolbox = GIMP_TOOLBOX (data);
>     if (toolbox)
>         gimptoolbox_refresh_commands (toolbox);
> }

Hi,

Please don't break threads by sending to just one persion, continue the
thread on gimp-developer.

The "update" signal on GimpUIManager has a parameter, as can be seen in
app/widgets/gimpuimanager.c:

  manager_signals[UPDATE] =
    g_signal_new ("update",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (GimpUIManagerClass, update),
                  NULL, NULL,
                  gimp_marshal_VOID__POINTER,
                  G_TYPE_NONE, 1,
                  G_TYPE_POINTER);

where 1, G_TYPE_POINTER means the signal has one parameter of type
pointer. It is this parameter you get in your 'data' in your callback.
Your callback signature shall look like it does for other clients, such
as the tool options menu:

  g_signal_connect (manager, "update",
                    G_CALLBACK (tool_options_menu_update),
                    (gpointer) ui_path);

  // ...

static void
tool_options_menu_update (GimpUIManager *manager,
                          gpointer       update_data,
                          const gchar   *ui_path)

I.e. you need to "make room" for the "update" signal parameter.

Hope this helps,

 / Martin

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux