Re: Using glade and Actions



On 05/11/2012 04:08 PM, Kjell Ahlstedt wrote:
> Haven't you noticed the Gtk::Builder::get_object() method?
> 
> Its documentation says "Note that this function does not increment the
> reference count of the returned object." That's wrong. That sentence is
> there just because the documentation is copied from the documentation of
> gtk_builder_get_object().
> 
> Kjell
> 
> 2012-05-10 23:47, g4hx skrev:
>> Hello everyone,
>>
>> unfortunately, I have a new problem with gtk3mmm: I have some
>> Actions/ActionGroups created using glade. Now I want to connect the
>> on_activate() signal of a certain Action to a member function of my
>> class. To this end, I need to get a reference to this Action from the
>> Builder. However, the Builder only has a get_widget method, which fails
>> with:
>>
>> "gtkmm: object `ActZoomIn' (type=`gtkmm__GtkActionGroup') (in GtkBuilder
>> file) is not a widget type."
>>
>> My question is how to obtain the Action form the Builder or else how to
>> rewrite the code or modify the glade file to connect the Action's
>> method. Btw I also need a reference to an ActionGroup to call its
>> set_sensitive method, so glade's handler functions alone won't be
>> sufficient for me.
>>
>> g4hx
>> _______________________________________________
>>
> 
> 

Well, reference counters aside, I would much appreciate a (preferably
type-safe) way to obtain either a pointer or a Glib::RefPtr to the
Gtk::Action. The get_object is not template-based and returns a
GLib::RefPtr<Glib::Object> and I don't know how to convert this to a
Gtk::Action* or GLib::RefPtr<Gtk::Action>.
If Gtk::Actions and Gtk::ActionGroups are available in glade, they
should be usable from the underlying code. Could anyone please point me
in the right direction here? I have already looked through many of the
links to programs using gtk3mm, but so far I have found nothing.

g4hx


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