gtk_action_group_add_action_with_accel() question



Jody,

I've been talking with Matthias Clasen about bug 125322 and I'm writing a patch that adds gtk_(whatever)_action_new() functions. Now that your've added gtk_action_group_add_action_with_accel() it makes things easier but there is some argument overlap. For example, gtk_action_new() would look like this:

GtkAction*
gtk_action_new (const gchar *name,
              const gchar *label,
              const gchar *tooltip,
              const gchar *stock_id)
{
GtkAction *action;

action = g_object_new (GTK_TYPE_ACTION,
                       "name", name,
                       "label", label,
                       "tooltip", tooltip,
                       "stock_id", stock_id,
                       NULL);

return action;
}

Then the g_object_new() call in gtk_action_group_add_actions_full() could be replaced by a call to gtk_action_new():

action = gtk_action_new (entries[i].name,
                  label,
                  tooltip,
                  entries[i].stock_id,
                  NULL);

To add an action created by gtk_action_new() you would have to call the new gtk_action_group_add_action_with_accel() function;

GtkAction *action;

action = gtk_action_new (name, label, tooltip, stock_id);
gtk_action_group_add_with_accel (action_group, action, name, accel, stock_id);

Doesn't it seem unecessary to create an action with a name and stock_id and then have to specify the name and stock_id again when you add it to an action group. The GtkAction already stores this information. I just wanted to run this past you before submitting any patch, so I can get the code right.

Jeff Franks.





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