2016-08-02 2 views
0

on_applet_clickedのコードの書き方は、内容が例のGtkPopoverです。 gtk_popover_new()と次にこれは何ですか?GtkPopoverとアプレット

const Applet = imports.ui.applet; 
const Util = imports.misc.util; 

function MyApplet(orientation, panel_height, instance_id) { 
    this._init(orientation, panel_height, instance_id); 
} 

MyApplet.prototype = { 
    __proto__: Applet.IconApplet.prototype, 

    _init: function(orientation, panel_height, instance_id) { 
     Applet.IconApplet.prototype._init.call(this, orientation, panel_height, instance_id); 

     this.set_applet_icon_name("folder-system"); 
     this.set_applet_tooltip(_("Click here to kill a window")); 
    }, 

    on_applet_clicked: function() { 
     // here 
    } 
}; 

function main(metadata, orientation, panel_height, instance_id) { 
    return new MyApplet(orientation, panel_height, instance_id); 
} 

答えて

1

CinnamonウィンドウマネージャのUIエレメント内でGTK +を使用することはできません。

GTK +は、クライアント側のアプリケーションツールキットです。ウィンドウマネージャの内部では使用できません。

アプレットのメニューを使用する場合は、としてそれをインポートすることにより、PopupMenuインスタンスを使用する必要があります:

const PopupMenu = imports.ui.popupMenu; 

PopupMenuItemインスタンスとそのサブクラスを移入。