Ubuntu: Icon name for unlocked keyring



Question:

I am working on a program and I want to implement icon denoting keyring state. If you start seahorse you'll see it has the same icon of padlock in two states, locked and unlocked.

I am unable to find unlocked icon name. There are many locked padlocks in /usr/share/icons but I didn't find any unlocked icons.

So, my question is, what's the name of the icon I can use with set_from_icon_name method.

Note: stock_lock-open is not the one am looking for.


Solution:1

Here you go, taken from the Seahorse source:

from gi.repository import Gtk, Gio    icon_theme = Gtk.IconTheme.get_default()  def get_pixbuf_from_themed_icon(name, size):      icon = Gio.ThemedIcon.new_with_default_fallbacks(name)      icon_info = icon_theme.lookup_by_gicon(icon, size, 0)      return icon_info.load_icon()    pixbuf_lock = get_pixbuf_from_themed_icon("changes-prevent-symbolic", 48)  pixbuf_unlock = get_pixbuf_from_themed_icon("changes-allow-symbolic", 48)    win = Gtk.Window()  win.resize(300, 300)  win.connect('delete-event', Gtk.main_quit)    vbox = Gtk.VBox(False, 4)  img_lock = Gtk.Image.new_from_pixbuf(pixbuf_lock)  vbox.pack_start(img_lock, False, False, 0)  img_unlock = Gtk.Image.new_from_pixbuf(pixbuf_unlock)  vbox.pack_start(img_unlock, False, False, 0)    win.add(vbox)  win.show_all()  Gtk.main()  

Only problem is the dark version. I couldn't translate the create_spotlight_pixbuf function to Python.

You might also want to look at the GtkLockButton.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »