Re: libseed-list Gtk.StatusIcon.position_menu and Gtk.Menu.Popup : problem



Yes, it's a known bug - I need to have a look at the source to fix this. - there are 2 issues
a) the function pointer needs to get sent as the argument.
b) the void* userdata needs to point to the gobject.

I've got a workaround here
http://git.akbkhome.com/?p=gitlive;a=blob;f=StatusIcon.js;h=7f78a731baac142d6a3362d7f66edfa05067a827;hb=HEAD

but this needs fixes to the GIR
the last two arguments of gtk_statusicon_get_geometry should be inout. - that's in bugzilla at present.

Regards
Alan

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]