Re: libseed-list Gtk.StatusIcon.position_menu and Gtk.Menu.Popup : problem
- From: Alan Knowles <alan akbkhome com>
- To: Marin Moulinier <marin star1 gmail com>
- Cc: libseed-list gnome org
- Subject: Re: libseed-list Gtk.StatusIcon.position_menu and Gtk.Menu.Popup : problem
- Date: Sat, 17 Apr 2010 22:32:52 +0800
Try this. - the callback code is already there, it's just the void*
fixes that are needed..
Regards
Alan
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index defc766..ae180a4 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -481,10 +481,22 @@ seed_gi_make_argument (JSContextRef ctx,
switch (gi_tag)
{
case GI_TYPE_TAG_VOID:
- // things like gio.outputstream.write use void pointers
- if (g_type_info_is_pointer (type_info))
- arg->v_string = seed_value_to_string (ctx, value, exception);
-
+ /* things like gio.outputstream.write use void pointers */
+ if (g_type_info_is_pointer (type_info))
+ {
+ GObject *gobject;
+ if (JSValueIsString (ctx, value)) {
+ /* perhaps a few other types.. */
+ arg->v_string = seed_value_to_string (ctx,
value, exception);
+ break;
+ }
+
+ gobject = seed_value_to_object (ctx, value, exception);
+ if (!gobject)
+ return FALSE;
+
+ arg->v_pointer = gobject;
+ }
break;
Marin Moulinier wrote:
Hello,
I try to do a status icon with a popup menu who shows when the
popup_menu event is triggered by the GtkStatusIcon.
Here is the code :
#!/usr/bin/env seed
// Import and initialize GTK+
Gtk = imports.gi.Gtk;
Gtk.init(null, null);
// Create the window
var window = new Gtk.Window({title: "Hello World"});
window.set_default_size(600, 500);
window.signal.hide.connect(Gtk.main_quit);
// Create the GtkStatusIcon from a file
var icon = new Gtk.StatusIcon({file :
"/home/marin/Bureau/Bric_a_brac/notify/icon.png"});
// Create the menu
var menu = new Gtk.Menu();
// Create an item
var item = new Gtk.MenuItem({label: "Hello"});
menu.append(item);
// Signal connecting the popup_menu event of the icon to the
"activate" function
icon.signal.popup_menu.connect(active, menu);
function active(status_icon, button, time, data)
{
// GtkMenu.popup, calling the Gtk.StatusIcon.position_menu function
menu.popup(null, null, Gtk.StatusIcon.position_menu, status_icon,
button, time);
}
window.show_all();
Gtk.main();
The problem : when I do a right click on the GtkStatusIcon, the menu
does not appear and I get this error :
(seed:4657): Gtk-CRITICAL **: gtk_status_icon_position_menu: assertion
`GTK_IS_STATUS_ICON (user_data)' failed
Yet, status_icon - that GtkMenu.popup() has sent to
Gtk.StatusIcon.position_menu() as the user_data argument - is a status
icon...
Gtk.Menu.popup on the documentation :
http://devel.akbkhome.com/seed/Gtk.Menu.html#Gtk.Menu-method-popup
Gtk.StatusIcon.position_menu on the documentation :
http://devel.akbkhome.com/seed/Gtk.StatusIcon.html#Gtk.StatusIcon-method-position_menu
Thank you in advance.
------------------------------------------------------------------------
_______________________________________________
libseed-list mailing list
libseed-list gnome org
http://mail.gnome.org/mailman/listinfo/libseed-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]