Re: Gtk::AccelGroup::connect() missing?

On 9/12/06, Matt Hoosier <mwhoosier gmail com> wrote:
On 9/12/06, Murray Cumming <murrayc murrayc com> wrote:
> > Hi,
> >
> > This is a friendly inquiry to see whether the wrappings for
> > GtkAccelGroup's "connect" and "connect_by_path" methods have been
> > omitted by design.
> >
> >
> >
> > The .hg file for the AccelGroup class has those two methods tucked
> > inside an _IGNORE() block, but no comment exists to say whether
> > there's fundamental brokenness about them, or perhaps they just
> > haven't been requested up to this point.
> The main reason that they are not wrapped is that they take GClosure
> parameters, which suggests that they are some funky thing only needed for
> GTK+ internals or only needed rarely.
> Hopefully the same effect can be achieved with other parts of the API.
> Does that seem to be the case?
> For instance, by specifying the accelerator and callback slot when
> creating the Gtk::Action. I don't understand why anybody would want a
> separate callback for an accelerator, instead of one callback for both the
> accelerator and normal activation.

Okay, that seems reasonable. I suppose that the slot gets attached by
fetching the Gtk::Action::signal_activate object, but how does one
specify the actual accelerator (for purposes of argument, suppose it's
the Escape key) that should be used to activate the action? I don't
see any obvious function on the Action class which attaches an

Suppose we've got the following already:

  Gtk::Window w;
  Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create ();
  Glib::RefPtr<Gtk::AccelGroup> refGroup = Gtk::AccelGroup::create ();

  w.add_accel_group (w);
  refAction.signal_activate ().connect ( ... );
  // what next?

Cancel that query. The following works well:

 Glib::ustring path = "<HelloWorld>/Category/Action";
 refAction->set_accel_group (refGroup);
 refAction->set_accel_path (path);
 refAction->connect_accelerator ();
 Gtk::AccelMap::add_entry (path, GDK_Escape, (Gdk::ModifierType) 0);

This question seems to be straying into just questions about Gtk+ API;
feel free to direct me to gtk-list instead.

> Murray Cumming
> murrayc murrayc com

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