static void
seahorse_secure_buffer_finalize (GObject *obj)
{
	SeahorseSecureBuffer *self = SEAHORSE_SECURE_BUFFER (obj);
	SeahorseSecureBufferPrivate *pv = self->priv;

	if (pv->text) {
		gnome_keyring_memory_free (pv->text);
		pv->text = NULL;
		pv->text_bytes = pv->text_size = 0;
		pv->text_chars = 0;
	}

	G_OBJECT_CLASS (seahorse_secure_buffer_parent_class)->finalize (obj);
}
Пример #2
0
static GtkWidget *
fill_password (GladeXML *xml,
               const char *widget_name,
               NMConnection *connection,
               const char *password_type)
{
    GtkWidget *widget = NULL;
    gchar *password = NULL;

    widget = glade_xml_get_widget (xml, widget_name);
    g_assert (widget);

    if (!connection)
        return widget;

    password = NULL;

    if (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM) {
        NMSettingVPN *s_vpn;

        s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
        if (s_vpn) {
            const gchar *tmp = NULL;

            tmp = nm_setting_vpn_get_secret (s_vpn, password_type);
            if (tmp)
                password = gnome_keyring_memory_strdup (tmp);
        }
    } else {
        NMSettingConnection *s_con = NULL;
        gboolean unused;
        const char *uuid;

        s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
        uuid = nm_setting_connection_get_uuid (s_con);
        password = keyring_helpers_lookup_secret (uuid,
                   password_type,
                   &unused);
    }

    if (password) {
        gtk_entry_set_text (GTK_ENTRY (widget), password);
        gnome_keyring_memory_free (password);
    }

    return widget;
}