class IdCard : Object {
+ public Gdk.Pixbuf pixbuf {get; set; default = null; }
public string issuer { get; set; default = null; }
public string username { get; set; default = null; }
public string password { get; set; default = null; }
{
this.id_card = id_card;
- Gdk.Pixbuf pixbuf;
-
- var icon_theme = IconTheme.get_default ();
- try
- {
- pixbuf = icon_theme.load_icon ("avatar-default",
- 48,
- IconLookupFlags.FORCE_SIZE);
- }
- catch (Error e)
- {
- pixbuf = null;
- stdout.printf("Error: %s\n", e.message);
- }
- var image = new Image.from_pixbuf (pixbuf);
+ var image = new Image.from_pixbuf (id_card.pixbuf);
var issuer = Markup.printf_escaped ("<b>%s</b>", this.id_card.issuer);
var services = Markup.printf_escaped ("<i>%s</i>", "Send Email, Connect to jabber");
show_details (id_card_widget.id_card);
}
- private void add_identity (AddIdentityDialog dialog)
+ private IdCard get_id_card_data (AddIdentityDialog dialog)
{
var id_card = new IdCard ();
id_card.username = dialog.username;
id_card.password = dialog.password;
+ var icon_theme = IconTheme.get_default ();
+ try
+ {
+ id_card.pixbuf = icon_theme.load_icon ("avatar-default",
+ 48,
+ IconLookupFlags.FORCE_SIZE);
+ }
+ catch (Error e)
+ {
+ id_card.pixbuf = null;
+ stdout.printf("Error: %s\n", e.message);
+ }
+
+ return id_card;
+ }
+
+ private void add_identity (AddIdentityDialog dialog)
+ {
+ var id_card = get_id_card_data (dialog);
+
var id_card_widget = new IdCardWidget (id_card);
this.custom_vbox.pack_start (id_card_widget, false, false);