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



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.


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