#!/usr/bin/python2

"""
Creates a status icon and listens for the available size.
Since some time 'size' is only 1 under GS, so the resulting pixbuf is 1x1px
and the icon isn't visible.
"""

from gi.repository import Gtk, GLib

def size_changed_cb(icon, size):
    theme = Gtk.IconTheme.get_default()
    print "size-changed: %d" % size
    pixbuf = theme.load_icon("edit-find", size, Gtk.IconLookupFlags.FORCE_SIZE)
    print "Got pixbuf %dx%d" % (pixbuf.get_width(), pixbuf.get_height())
    icon.set_from_pixbuf(pixbuf)
    return True # True if the icon was updated for the new size

icon = Gtk.StatusIcon.new()
icon.connect("size-changed", size_changed_cb)

GLib.unix_signal_add(0, 2, Gtk.main_quit)
Gtk.main()
