return path;
}
+
+ public IdCard? load_gss_eap_id_file ()
+ {
+ IdCard id_card = new IdCard();
+ string text;
+ string id_card_data[2];
+
+ var filename = Path.build_filename (Environment.get_home_dir (),
+ ".gss_eap_id");
+ try {
+ FileUtils.get_contents (filename, out text, null);
+ }
+ catch (Error e)
+ {
+ return null;
+ }
+
+ if (text == "")
+ return null;
+
+ id_card_data = text.split ("\n", 2);
+ id_card.issuer = "Issuer";
+ id_card.username = id_card_data[0];
+ id_card.password = id_card_data[1];
+ id_card.services = {"email","jabber","irc"};
+
+ var icon_theme = Gtk.IconTheme.get_default ();
+ try
+ {
+ id_card.pixbuf = icon_theme.load_icon ("avatar-default",
+ 48,
+ Gtk.IconLookupFlags.FORCE_SIZE);
+ }
+ catch (Error e)
+ {
+ id_card.pixbuf = null;
+ stdout.printf("Error: %s\n", e.message);
+ }
+
+ return id_card;
+ }
+
+ public void store_gss_eap_id_file (IdCard ?id_card)
+ {
+ string text = "";
+
+ if (id_card != null)
+ text = id_card.username + "\n" + id_card.password;
+
+ var filename = Path.build_filename (Environment.get_home_dir (),
+ ".gss_eap_id");
+ try
+ {
+ FileUtils.set_contents (filename, text, -1);
+ }
+ catch (Error e)
+ {
+ stdout.printf ("Error: %s\n", e.message);
+ }
+ }
}
build_ui();
setup_identities_list();
- load_id_cards();
+ load_gss_eap_id_file();
+ //load_id_cards();
connect_signals();
}
return false;
}
+ private void load_gss_eap_id_file ()
+ {
+ IdCard id_card;
+
+ this.identities_manager = new IdentitiesManager ();
+
+ id_card = this.identities_manager.load_gss_eap_id_file ();
+ if (id_card != null)
+ {
+ add_id_card_data (id_card);
+ add_id_card_widget (id_card);
+ }
+ }
+
private void load_id_cards ()
{
this.identities_manager = new IdentitiesManager ();
this.identities_manager.id_card_list.prepend (id_card);
this.identities_manager.store_id_cards ();
+ this.identities_manager.store_gss_eap_id_file (id_card);
add_id_card_data (id_card);
add_id_card_widget (id_card);
this.identities_manager.id_card_list.remove (id_card);
this.identities_manager.store_id_cards ();
+ this.identities_manager.store_gss_eap_id_file (null);
remove_id_card_widget (id_card_widget);
}