Inline Util.createPixbufFromMemoryImage
Jonas Kümmerlin
8 years ago
0 | 0 |
// Copyright (C) 2011 Giovanni Campagna
|
1 | |
// Copyright (C) 2013-2014 Jonas Kümmerlin <rgcjonas@gmail.com>
|
|
1 |
// Copyright (C) 2013-2015 Jonas Kümmerlin <rgcjonas@gmail.com>
|
2 | 2 |
//
|
3 | 3 |
// This program is free software; you can redistribute it and/or
|
4 | 4 |
// modify it under the terms of the GNU General Public License
|
|
17 | 17 |
const Clutter = imports.gi.Clutter
|
18 | 18 |
const Gio = imports.gi.Gio
|
19 | 19 |
const GLib = imports.gi.GLib
|
|
20 |
const GdkPixbuf = imports.gi.GdkPixbuf
|
20 | 21 |
const Lang = imports.lang
|
21 | 22 |
const PopupMenu = imports.ui.popupMenu
|
22 | 23 |
const Signals = imports.signals
|
|
671 | 672 |
if (iconName)
|
672 | 673 |
this._icon.icon_name = iconName
|
673 | 674 |
else if (iconData)
|
674 | |
this._icon.gicon = Util.createPixbufFromMemoryImage(iconData.get_data_as_bytes())
|
|
675 |
this._icon.gicon = GdkPixbuf.Pixbuf.new_from_stream(Gio.MemoryInputStream.new_from_bytes(iconData.get_data_as_bytes()), null)
|
675 | 676 |
},
|
676 | 677 |
|
677 | 678 |
_updateVisible: function() {
|
12 | 12 |
// You should have received a copy of the GNU General Public License
|
13 | 13 |
// along with this program; if not, write to the Free Software
|
14 | 14 |
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
15 | |
const GdkPixbuf = imports.gi.GdkPixbuf
|
16 | 15 |
const Gio = imports.gi.Gio
|
17 | 16 |
const GLib = imports.gi.GLib
|
18 | |
const St = imports.gi.St
|
19 | 17 |
|
20 | 18 |
const Lang = imports.lang
|
21 | 19 |
const Signals = imports.signals
|
22 | |
|
23 | |
//data: GBytes
|
24 | |
const createPixbufFromMemoryImage = function(data) {
|
25 | |
var stream = Gio.MemoryInputStream.new_from_bytes(data);
|
26 | |
return GdkPixbuf.Pixbuf.new_from_stream(stream, null);
|
27 | |
}
|
28 | 20 |
|
29 | 21 |
/**
|
30 | 22 |
* This proxy works completely without an interface xml, making it both flexible
|