RSS/Atom feed Twitter
Site is read-only, email is disabled

connecting to update signal in uimanager

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

7 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

connecting to update signal in uimanager Jordan Stinson 30 Jun 02:02
  connecting to update signal in uimanager Simon Budig 30 Jun 02:44
  connecting to update signal in uimanager Martin Nordholts 30 Jun 06:52
   connecting to update signal in uimanager Jordan Stinson 30 Jun 15:23
    connecting to update signal in uimanager Martin Nordholts 30 Jun 17:55
9d21316e0906301508y35c63a55... 07 Oct 20:27
  connecting to update signal in uimanager Martin Nordholts 01 Jul 06:39
   connecting to update signal in uimanager Jordan Stinson 01 Jul 12:53
Jordan Stinson
2009-06-30 02:02:25 UTC (over 15 years ago)

connecting to update signal in uimanager

Hi there,
I'm trying to hack gimp. For my purposes, I want to be notified when certain actions become sensitive, or insensitive. The way I wanted to do this was to store the actions I wanted to keep track of and connect to the UIManager's update signal. That way, when an update happened, my callback function would be called and I could loop through my list and check the sensitive property of my actions. My problem is when I connect to the update command, I set the update data (the last parameter), which doesn't end up being what is passed to my callback function. In fact, its a GimpDisplay pointer that's being passed, instead of the pointer to my data. I'm pretty new to GTK as well as GIMP, so please forgive my ignorance. Thanks in advance!

- Jordan

Simon Budig
2009-06-30 02:44:06 UTC (over 15 years ago)

connecting to update signal in uimanager

Jordan Stinson (jordan.stinson83@gmail.com) wrote:

I'm trying to hack gimp. For my purposes, I want to be notified when certain actions become sensitive, or insensitive. The way I wanted to do this was to store the actions I wanted to keep track of and connect to the UIManager's update signal. That way, when an update happened, my callback function would be called and I could loop through my list and check the sensitive property of my actions.

Wouldn't it make more sense to connect to "notify::sensitive" on the actions you're interested in?

Bye, Simon

Martin Nordholts
2009-06-30 06:52:25 UTC (over 15 years ago)

connecting to update signal in uimanager

On 06/30/2009 02:02 AM, Jordan Stinson wrote:

Hi there,

I'm trying to hack gimp. For my purposes, I want to be notified when certain actions become sensitive, or insensitive.

Why not subscribe to changes to whatever it is that changes the sensitivity of your action instead of subscribing to changes of the sensitivity of the action itself?

/ Martin

Jordan Stinson
2009-06-30 15:23:09 UTC (over 15 years ago)

connecting to update signal in uimanager

Simon,I didn't think of subscribing to the notify::sensitive action on the action itself; I suppose I should have though.

Martin, I think the thing that changes the sensitivity of the actions is the UIManager via each action group. So, that's what I'm doing or trying to do at least.

Is there any reason why when I subscribe to the "update" signal in the UIManager, the update data I set doesn't make it back to my callback function?

Thanks,
Jordan

On Tue, Jun 30, 2009 at 12:54 AM, Martin Nordholts wrote:

On 06/30/2009 02:02 AM, Jordan Stinson wrote:

Hi there,

I'm trying to hack gimp. For my purposes, I want to be notified when certain actions become sensitive, or insensitive.

Why not subscribe to changes to whatever it is that changes the sensitivity of your action instead of subscribing to changes of the sensitivity of the action itself?

/ Martin

Martin Nordholts
2009-06-30 17:55:19 UTC (over 15 years ago)

connecting to update signal in uimanager

On 06/30/2009 03:23 PM, Jordan Stinson wrote:

Is there any reason why when I subscribe to the "update" signal in the UIManager, the update data I set doesn't make it back to my callback function?

Some code would help here

Probably, you using g_signal_connect_swapped() instead of g_signal_connect(), or vice versa.

/ Martin

Martin Nordholts
2009-07-01 06:39:29 UTC (over 15 years ago)

connecting to update signal in uimanager

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

Jordan Stinson
2009-07-01 12:53:54 UTC (over 15 years ago)

connecting to update signal in uimanager

Yes, this helps.
Thanks!

- Jordan

On Wed, Jul 1, 2009 at 12:41 AM, Martin Nordholts 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