Re: Can't connect control to activate signal
"Gustavo J. A. M. Carneiro" <[email protected]> Mon, 13 Oct 2003 14:38:44 +0100
| Newsgroups | gmane.comp.gnome.components |
|---|---|
| Organization | INESC |
| Message-ID | <[email protected]> |
A Seg, 2003-10-13 Ã s 14:06, Matthew J Hicks escreveu:
>
>
> I have been trying to create a control with a menu structure that will
> merge into my container's menu (and hopefully Nautilus's menu) with no
> luck. So far, I have been able to create a very simple container (source
> not included to keep the email shorter) that can merge controls with menus
> such as the GNOME_EOG_Control. I have also created my own
> GNOME_Test_Control but unfortunately, it's menu does not merge with my
> container's menus. The widget label is displayed in the container - only
> the menu merging doesn't take place. I have looked through the
> documentation, but haven't found any simple examples of menu merging.
>
> I think that the problem is that my activate callback is not being called.
> I put some debug statements in the libbonoboui package and the "activate"
> signal is being emitted, but just not received in my control. I have tried
> the gtk_signal_connect and the g_signal_connect methods, but neither appear
> to work. If someone could help me out, I would really appreciate it.
Yeah, I've run into the same problem in the past. I ended up
connecting to the "set-frame" signal (copying EOG's example, I think).
I'm not 100% sure that I'm doing the correct thing, but it works well.
Here's my python handler for set-frame, and I'm sure you can easily
translate that to C:
def __set_frame_cb(self, control):
frame = control.get_control_frame()
if frame is None:
uic = control.get_ui_component()
uic.unset_container()
else:
ui_component = self.get_ui_component()
ui_component.set_container(self.get_remote_ui_container())
bonobo.ui.util_set_ui(ui_component, '',
gnumexp_conf.UIDIR + '/Numexp_Console-ui.xml',
'numexp-console')
verbs = [
("ViewDefinitions", self.__view_definitions_toggle_cb),
("Modules", self.__modules_cb),
("MathMLOutput", self.__mathml_output_toggle_cb),
]
ui_component.add_verb_list(verbs)
ui_component.connect('ui-event', self.__ui_event)
self._read_settings(ui_component)
--
Gustavo J. A. M. Carneiro
<[email protected]> <[email protected]>