Codebase list gnome-shell-extension-appindicator / bc5a80a
Inline Util.createPixbufFromMemoryImage Jonas Kümmerlin 8 years ago
2 changed file(s) with 3 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
00 // 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>
22 //
33 // This program is free software; you can redistribute it and/or
44 // modify it under the terms of the GNU General Public License
1717 const Clutter = imports.gi.Clutter
1818 const Gio = imports.gi.Gio
1919 const GLib = imports.gi.GLib
20 const GdkPixbuf = imports.gi.GdkPixbuf
2021 const Lang = imports.lang
2122 const PopupMenu = imports.ui.popupMenu
2223 const Signals = imports.signals
671672 if (iconName)
672673 this._icon.icon_name = iconName
673674 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)
675676 },
676677
677678 _updateVisible: function() {
1212 // You should have received a copy of the GNU General Public License
1313 // along with this program; if not, write to the Free Software
1414 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 const GdkPixbuf = imports.gi.GdkPixbuf
1615 const Gio = imports.gi.Gio
1716 const GLib = imports.gi.GLib
18 const St = imports.gi.St
1917
2018 const Lang = imports.lang
2119 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 }
2820
2921 /**
3022 * This proxy works completely without an interface xml, making it both flexible